ageOfMe = 15
print("Age of me: " + str(ageOfMe))
Age of me: 15
n = 6
print("Integer:", n)
print("Float:", float(n))
print("String: " + str(n))
print("Bool: " + str(bool(n)))
Integer: 6
Float: 6.0
String: 6
Bool: True
one = 1
two = 2
three = 3
extra = two
two = one
one = three
three = extra
print(one)
print(two)
print(three)
3
1
2
secret = "Tanay's age is 16"
for i in range(len(secret)):
print(secret[i])
T
a
n
a
y
'
s
a
g
e
i
s
1
6
random = {
"thing1": "10",
"thing2": "7",
"thing3": "in the fetus"
}
for person in random:
print("Thing name: " + person + "\nTheir Age: " + random[person])
Thing name: thing1
Their Age: 10
Thing name: thing2
Their Age: 7
Thing name: thing3
Their Age: in the fetus
import json
#converting random dictionary to json
json_random_obj = json.dumps(random)
print(json_random_obj)
{"thing1": "10", "thing2": "7", "thing3": "in the fetus"}
def checkType(inputVar):
print(type(inputVar))
checkType(random)
<class 'dict'>
friends = ["nobody", "loneliness", "arnav+nandan+dagoat"]
json_friends_obj = json.dumps(friends)
print(json_friends_obj)
["nobody", "loneliness", "arnav+nandan+dagoat"]
#Hack 1
#secretNumber is an integer
#the food variable is a string
#the names variable is a list
#the IamCool variable is set incorrectly and is also boolean
#the names_2 variable is a dictionary
#Hack 2
grades = {
"dudeamabobby": 54,
"oddvik": 110,
"uusray": -35,
"lolbit": 95
}
def find_highest_grade(grades):
highest_grade = None
max_grade = 0
for name, grade in grades.items():
if grade > max_grade:
max_grade = grade
highest_grade = name
if highest_grade is not None:
print(f"The GOAT and extremely studious individual is {highest_grade} with a grade of {max_grade}")
else:
print("All of yall suck")
find_highest_grade(grades)
The GOAT and extremely studious individual is oddvik with a grade of 110