Skip to content

Commit 5cf7836

Browse files
author
K-Waks
committed
updated code and renamed files
1 parent 3bb4450 commit 5cf7836

11 files changed

+1875
-1202
lines changed
File renamed without changes.

2_Variables_and_DataTypes.ipynb renamed to 2) variables, data types and user input.ipynb

+84-6
Original file line numberDiff line numberDiff line change
@@ -62,36 +62,36 @@
6262
},
6363
{
6464
"cell_type": "code",
65-
"execution_count": 2,
65+
"execution_count": 1,
6666
"id": "c625d1e8",
6767
"metadata": {},
6868
"outputs": [
6969
{
7070
"name": "stdout",
7171
"output_type": "stream",
7272
"text": [
73-
"Hiii\n"
73+
"Hiii 👋\n"
7474
]
7575
}
7676
],
7777
"source": [
78-
"x = \"Hiii\"\n",
78+
"x = \"Hiii 👋\"\n",
7979
"print(x)"
8080
]
8181
},
8282
{
8383
"cell_type": "code",
84-
"execution_count": 3,
84+
"execution_count": 2,
8585
"id": "396bd3c1",
8686
"metadata": {},
8787
"outputs": [
8888
{
8989
"data": {
9090
"text/plain": [
91-
"'Hiii'"
91+
"'Hiii 👋'"
9292
]
9393
},
94-
"execution_count": 3,
94+
"execution_count": 2,
9595
"metadata": {},
9696
"output_type": "execute_result"
9797
}
@@ -425,6 +425,84 @@
425425
"- Python uses a form of dynamic typing, sometimes called **duck typing**, where the type of a value is determined by the value itself. In other words, if it walks like a duck, it's a duck."
426426
]
427427
},
428+
{
429+
"attachments": {},
430+
"cell_type": "markdown",
431+
"id": "e5ae30d3",
432+
"metadata": {},
433+
"source": [
434+
"## Using `input()` to get user input"
435+
]
436+
},
437+
{
438+
"cell_type": "code",
439+
"execution_count": 4,
440+
"id": "9be7cb0b",
441+
"metadata": {},
442+
"outputs": [
443+
{
444+
"name": "stdout",
445+
"output_type": "stream",
446+
"text": [
447+
"Kevin\n"
448+
]
449+
},
450+
{
451+
"data": {
452+
"text/plain": [
453+
"str"
454+
]
455+
},
456+
"execution_count": 4,
457+
"metadata": {},
458+
"output_type": "execute_result"
459+
}
460+
],
461+
"source": [
462+
"name = input(\"What's your name?\")\n",
463+
"print(name)\n",
464+
"type(name)"
465+
]
466+
},
467+
{
468+
"attachments": {},
469+
"cell_type": "markdown",
470+
"id": "9c6035d2",
471+
"metadata": {},
472+
"source": [
473+
"- Typecast to an `int` in order to get integer input, or a `float()` if you want decimals, etcetera."
474+
]
475+
},
476+
{
477+
"cell_type": "code",
478+
"execution_count": 5,
479+
"id": "20781134",
480+
"metadata": {},
481+
"outputs": [
482+
{
483+
"name": "stdout",
484+
"output_type": "stream",
485+
"text": [
486+
"5\n"
487+
]
488+
},
489+
{
490+
"data": {
491+
"text/plain": [
492+
"int"
493+
]
494+
},
495+
"execution_count": 5,
496+
"metadata": {},
497+
"output_type": "execute_result"
498+
}
499+
],
500+
"source": [
501+
"num = int(input(\"What your favorite number\"))\n",
502+
"print(num)\n",
503+
"type(num)"
504+
]
505+
},
428506
{
429507
"attachments": {},
430508
"cell_type": "markdown",

0 commit comments

Comments
 (0)