Below is a broken python code
result = 50 * 5
print ('result = '+Result)
price_of_candy = 2
price_of_ice_cream = 3
total_price = priceof_candy + price_of_Ice_crm
print('total_price is $ '+totalprice)
user_input = input('What is the temperature outside? (30 to 100) '
hot_day = user_input > 90
print ('Is it hot outside? '+ hotDay)
if hot_day = True
print('It is really hot out there')
elif:
print('It is cool out there')
print('I live in '+ hometown
hometown = 'Moscow'
def subtract(num1 num2):
return num1-num2
print(subtract(10,1))
def starwars(prefix):
jedi = ['Luke', 'Obiwan', 'Qui Gon'
print(jedi['Luke'])
starwars('Jedi Master ')
When Above code is fixed, the program will print out the following in the shell.
result = 250
total_price is $5
What is the temperature outside? (30 to 100) 100
Is it hot outside? True
It is really hot out there
I live in Moscow
9
Jedi Master Luke
======================================================
result = 250
total_price is $5
What is the temperature outside? (30 to 100) 40
Is it hot outside? False
It is cool out there
I live in Moscow
9
Jedi Master Luke
Solution
result = 50 * 5
print ('result = '+str(result))
price_of_candy = 2
price_of_ice_cream = 3
total_price = price_of_candy + price_of_ice_cream
print('total_price is $ '+str(total_price))
user_input = input('What is the temperature outside? (30 to 100) ')
hot_day = int(user_input) > 90
print ('Is it hot outside? '+ str(hot_day))
if hot_day == True:
print('It is really hot out there')
else:
print('It is cool out there')
hometown = 'Moscow'
print('I live in '+ hometown)
def subtract(num1, num2):
return num1-num2
print(subtract(10,1))
def starwars(prefix):
jedi = ['Luke', 'Obiwan', 'Qui Gon']
print(prefix+jedi[0])
starwars('Jedi Master ')