Oct-17-2017, 11:26 PM
print ('What is your name')
myname= input('Input your name here:')
print ('Nice to meet you, '+myname)
print ('What fact would you like to know? Input a word form of a number 1-20')
fact= input()
print (fact)
if 1==fact:
print('What kind of meat is Spam?', end='Spam is a canned precooked meat product made by the Hormel Foods Corporation, first introduced in 1937. The labeled ingredients in the classic variety of Spam are chopped pork shoulder meat, with ham meat added, salt, water, modified potato starch as a binder, sugar, and sodium nitrite as a preservative.')
In the underlined line, if I input the number '1' while the code is running in the shell, the if statement will not run but an else statement will run. I need help to resolve this problem so the if statement runs if the input is '1'.
myname= input('Input your name here:')
print ('Nice to meet you, '+myname)
print ('What fact would you like to know? Input a word form of a number 1-20')
fact= input()
print (fact)
if 1==fact:
print('What kind of meat is Spam?', end='Spam is a canned precooked meat product made by the Hormel Foods Corporation, first introduced in 1937. The labeled ingredients in the classic variety of Spam are chopped pork shoulder meat, with ham meat added, salt, water, modified potato starch as a binder, sugar, and sodium nitrite as a preservative.')
In the underlined line, if I input the number '1' while the code is running in the shell, the if statement will not run but an else statement will run. I need help to resolve this problem so the if statement runs if the input is '1'.