Master-DataScience-Notes/1year/2trimester/Coding for Data Science - Python language/Python/Examples/Lezione2.ipynb

252 lines
3.8 KiB
Plaintext
Raw Normal View History

2020-02-11 11:22:21 +01:00
{
"cells": [
2020-02-11 15:01:46 +01:00
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"x = [2 ,3 ,4 ,\"a \"]"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"a, *y = x"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[3, 4, 'a ']"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"x = \"ciao\""
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'a'"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x[2]"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [],
"source": [
"t = (1,[2],\"ciao\")"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t[0]+2"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
"t = (t[0]+2,[2],\"ciao\")"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(3, [2], 'ciao')"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [],
"source": [
"t = (2,[2],\"ciao\")"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(2, [2], 'ciao')"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t"
]
},
2020-02-11 11:22:21 +01:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-02-11 15:01:46 +01:00
"# Singoletti"
2020-02-11 11:22:21 +01:00
]
},
{
"cell_type": "code",
2020-02-11 15:01:46 +01:00
"execution_count": 33,
"metadata": {},
"outputs": [],
"source": [
"t = (1,)"
]
},
{
"cell_type": "code",
"execution_count": 34,
2020-02-11 11:22:21 +01:00
"metadata": {},
"outputs": [
{
2020-02-11 15:01:46 +01:00
"data": {
"text/plain": [
"(1,)"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
2020-02-11 11:22:21 +01:00
}
],
"source": [
2020-02-11 15:01:46 +01:00
"t"
2020-02-11 11:22:21 +01:00
]
2020-02-11 11:25:51 +01:00
},
{
"cell_type": "code",
2020-02-11 15:01:46 +01:00
"execution_count": 35,
"metadata": {},
"outputs": [],
"source": [
"t=(1)"
]
},
{
"cell_type": "code",
"execution_count": 36,
2020-02-11 11:25:51 +01:00
"metadata": {},
"outputs": [
{
2020-02-11 15:01:46 +01:00
"data": {
"text/plain": [
"1"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
2020-02-11 11:25:51 +01:00
}
],
"source": [
2020-02-11 15:01:46 +01:00
"t"
2020-02-11 11:25:51 +01:00
]
2020-02-11 15:01:46 +01:00
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
2020-02-11 11:22:21 +01:00
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
2020-02-11 15:01:46 +01:00
"version": "3.6.7"
2020-02-11 11:22:21 +01:00
}
},
"nbformat": 4,
"nbformat_minor": 2
}