Lab Files Upload
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
# %%
|
||||
## Task 1
|
||||
print("A sentence.")
|
||||
lname = input("Please enter your last name: ")
|
||||
id = input("Please enter your student id: ")
|
||||
print(id, lname,sep=";")
|
||||
|
||||
# %%
|
||||
## Task 2
|
||||
# 1(a) type int
|
||||
# 1(b) type string
|
||||
# 1(c) type string
|
||||
# 1(d) type int
|
||||
|
||||
# 2(a) type constant int
|
||||
# 2(b) type string
|
||||
# 2(c) type int
|
||||
# 2(d) type float
|
||||
# 2(e) type boolean
|
||||
# 2(f) type float
|
||||
|
||||
# BONUS: 1(a) is most likely type constant int
|
||||
|
||||
# %%
|
||||
## Task 3
|
||||
# data1 - type float, 99.9
|
||||
# data2 - type integer, 99
|
||||
# data3 - type string, "99"
|
||||
# data4 - type boolean, True
|
||||
# data5 - type float, 0.9
|
||||
# data6 - Syntax Error
|
||||
|
||||
# %%
|
||||
## Task 4
|
||||
# 1. x=0.5
|
||||
# 2. x=0.5
|
||||
# 3. x=0.0
|
||||
# 4. x=0.25
|
||||
# 5. x=110
|
||||
# 5. x=1
|
||||
# 7. x=0
|
||||
# 8. x=.20
|
||||
x = 1 / 2
|
||||
print(x)
|
||||
x = 1 / 2.0
|
||||
print(x)
|
||||
x = 1 // 2
|
||||
print(x)
|
||||
x = 1 / 2 / 2
|
||||
print(x)
|
||||
x = 100 * 1.1
|
||||
print(x)
|
||||
x = 3 % 2
|
||||
print(x)
|
||||
x = 6 % 3
|
||||
print(x)
|
||||
x = 25 ** 0.5
|
||||
print(x)
|
||||
|
||||
# %%
|
||||
## Task 5
|
||||
# Task 5.1
|
||||
alpha = 5
|
||||
# Task 5.2
|
||||
beta = alpha - 1.25
|
||||
# Task 5.3
|
||||
gamma = alpha % 2
|
||||
# Task 5.4
|
||||
delta = alpha ** 4
|
||||
# Task 5.5
|
||||
epsilon = 9 // 2
|
||||
# Task 5.6
|
||||
alpha = alpha + 1
|
||||
# Task 5.7
|
||||
print(alpha, beta, gamma, delta, epsilon)
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"A sentence.\n",
|
||||
"10;Pease\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"## Task 1\n",
|
||||
"print(\"A sentence.\")\n",
|
||||
"lname = input(\"Please enter your last name: \")\n",
|
||||
"id = input(\"Please enter your student id: \")\n",
|
||||
"print(id, lname,sep=\";\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"## Task 2\n",
|
||||
"# 1(a) type int\n",
|
||||
"# 1(b) type string\n",
|
||||
"# 1(c) type string\n",
|
||||
"# 1(d) type int\n",
|
||||
"\n",
|
||||
"# 2(a) type constant int\n",
|
||||
"# 2(b) type string\n",
|
||||
"# 2(c) type int\n",
|
||||
"# 2(d) type float\n",
|
||||
"# 2(e) type boolean\n",
|
||||
"# 2(f) type float\n",
|
||||
"\n",
|
||||
"# BONUS: 1(a) is most likely type constant int"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"## Task 3\n",
|
||||
"# data1 - type float, 99.9\n",
|
||||
"# data2 - type integer, 99\n",
|
||||
"# data3 - type string, \"99\"\n",
|
||||
"# data4 - type boolean, True\n",
|
||||
"# data5 - type float, 0.9\n",
|
||||
"# data6 - Syntax Error"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"0.5\n",
|
||||
"0.5\n",
|
||||
"0\n",
|
||||
"0.25\n",
|
||||
"110.00000000000001\n",
|
||||
"1\n",
|
||||
"0\n",
|
||||
"5.0\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"## Task 4\n",
|
||||
"# 1. x=0.5 \n",
|
||||
"# 2. x=0.5\n",
|
||||
"# 3. x=0.0\n",
|
||||
"# 4. x=0.25\n",
|
||||
"# 5. x=110\n",
|
||||
"# 5. x=1\n",
|
||||
"# 7. x=0\n",
|
||||
"# 8. x=.20\n",
|
||||
"x = 1 / 2\n",
|
||||
"print(x)\n",
|
||||
"x = 1 / 2.0\n",
|
||||
"print(x)\n",
|
||||
"x = 1 // 2\n",
|
||||
"print(x)\n",
|
||||
"x = 1 / 2 / 2\n",
|
||||
"print(x)\n",
|
||||
"x = 100 * 1.1\n",
|
||||
"print(x)\n",
|
||||
"x = 3 % 2\n",
|
||||
"print(x)\n",
|
||||
"x = 6 % 3\n",
|
||||
"print(x)\n",
|
||||
"x = 25 ** 0.5\n",
|
||||
"print(x)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"## Task 5\n",
|
||||
"# Task 5.1\n",
|
||||
"alpha = 5\n",
|
||||
"# Task 5.2\n",
|
||||
"beta = alpha - 1.25\n",
|
||||
"# Task 5.3\n",
|
||||
"gamma = alpha % 2\n",
|
||||
"# Task 5.4\n",
|
||||
"delta = alpha ** 4\n",
|
||||
"# Task 5.5\n",
|
||||
"epsilon = 9 // 2\n",
|
||||
"# Task 5.6\n",
|
||||
"alpha = alpha + 1\n",
|
||||
"# Task 5.7\n",
|
||||
"print(alpha, beta, gamma, delta, epsilon)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3.10.7 64-bit (microsoft store)",
|
||||
"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",
|
||||
"version": "3.10.7"
|
||||
},
|
||||
"orig_nbformat": 4,
|
||||
"vscode": {
|
||||
"interpreter": {
|
||||
"hash": "6e4d43018b1079ec3d537b493836304b8dd5a8597a61d2dad10d7770111ce54e"
|
||||
}
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
Reference in New Issue
Block a user