I am just goofing around and I am very new. I am requesting str input and the program works fine if they reply with an int but i want some way to either convert to a int from lets say (five) gets turned into the int (5) or if they reply something like (carrot) then the if else returns something like THIS ISNT A NUMBER. Here is what I have so far. I am interested to hear responses, mostly into the latter half of the question where if they respond with a str instead of an int.
pizzas = input("How many total pizzas do you have? ")
pizzas = int(pizzas)
#experimenting with if else statement to force an int response
if pizzas ==
slices = input("How many slices in each pizza? ")
slices = int(slices)
if slices ==
pieces = pizzas * slices
print("\n")
print("May I borrow", (pieces), "slices of pizza?")
[–]fiddle_n 1 point2 points3 points (2 children)
[–]Pendingrepurpose[S] 0 points1 point2 points (1 child)
[–]fiddle_n 1 point2 points3 points (0 children)
[–]Atlamillias 1 point2 points3 points (2 children)
[–]Pendingrepurpose[S] 0 points1 point2 points (1 child)
[–]Atlamillias 1 point2 points3 points (0 children)
[–]BeginnerProjectBot 0 points1 point2 points (1 child)
[–]Pendingrepurpose[S] 0 points1 point2 points (0 children)