# [ ] review the code then run testing different inputs
# WHAT TO WEAR
weather = input("Enter weather (sunny, rainy, snowy): ")
if weather.lower() == "sunny":
print("Wear a t-shirt")
elif weather.lower() == "rainy":
print("Bring an umbrella and boots")
elif weather.lower() == "snowy":
print("Wear a warm coat and hat")
else:
print("Sorry, not sure what to suggest for", weather)
# [ ] review the code then run testing different inputs
# SECRET NUMBER GUESS
secret_num = "2"
guess = input("Enter a guess for the secret number (1-3): ")
if guess.isdigit() == False:
print("Invalid: guess should only use digits")
elif guess == "1":
print("Guess is too low")
elif guess == secret_num:
print("Guess is right")
elif guess == "3":
print("Guess is too high")
else:
print(guess, "is not a valid guess (1-3)")
# [ ] code and test SHIRT SALE
size=input("Enter your shirt size (Enter S,M,L)")
if size=="S":
print("Small = $6")
elif size.upper()=="M":
print("Medium = $7")
elif size=="L":
print("Large = $8")
else:
print("We do not have anything other sizes")
Medium = $7
weight1 = '60' # a string
weight2 = 170 # an integer
# add 2 integers
total_weight = int(weight1) + weight2
print(total_weight)
230
str_num_1 = "11"
str_num_2 = "15"
int_num_3 = 10
# [ ] Add the 3 numbers as integers and print the result
total= int(str_num_1)+ int(str_num_2)+ int_num_3
print(total)
36
str_num_1 = "11"
str_num_2 = "15"
int_num_3 = 10
# [ ] Add the 3 numbers as strings and print the result
total= str_num_1+ str_num_2+ str(int_num_3)
print(total)
111510
# [ ] code and test: adding using int casting
str_integer = "2"
int_number = 10
number_total = int(str_integer) + int_number
print(number_total)
12
# [ ] review and run code
student_age = input('enter student age (integer): ')
age_next_year = int(student_age) + 1
print('Next year student will be',age_next_year)
# [ ] review and run code
# cast to int at input
student_age = int(input('enter student age (integer): '))
age_in_decade = student_age + 10
print('In a decade the student will be', age_in_decade)
# [ ] code and test the adding calculator
num1=input("enter a number")
num2=input("enter a number")
if num1.isdigit() and num2.isdigit():
print((int(num1))+(int(num2)))
else:
print("Please enter a number like I said...")
Please enter a number like I said...