7**4
Run to view results
s = "Hi there Sam!"
s.split()
Run to view results
Run to view results
planet = "Earth"
diameter = 12742
print(f"The diameter of {planet} is {diameter} kilometers.")
Run to view results
Run to view results
lst = [1,2,[3,4],[5,[100,200,['hello']],23,11],1,7]
Run to view results
lst[3][1][2][0]
Run to view results
d = {'k1':[1,2,3,{'tricky':['oh','man','inception',{'target':[1,2,3,'hello']}]}]}
Run to view results
d['k1'][3]['tricky'][3]['target'][3]
Run to view results
print(f" A list uses brackets and can be changed, a tuple uses parentheses and can't be changed")
Run to view results
email = 'me@gmail.com'
email.split('@')[1]
Run to view results
sentence = "The dOg was a good boy"
if "dog" in sentence.lower():
print("hes a good boy")
else:
print("we didn't detect a dog")
Run to view results
count = 0
for i in sentence.lower().split():
if i == 'dog':
count += 1
print(f"dog count: {count}")
Run to view results
no_tick = "no ticket"
small_tick = "Small ticket"
big_tick = "Big ticket"
speed_variable = "50"
birthday_var = True
mph = int(speed_variable)
if birthday_var == True:
mph = mph - 5
else:
mph = mph
if mph <= 60:
print(f"you went {mph} mph so you get {no_tick}")
elif mph > 60 and mph < 81:
print(f"you went {mph} mph so you get {small_tick}")
elif mph >81:
print(f"you went {mph} mph so you get {big_tick}")
Run to view results