Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Input Question
#3
(Oct-18-2017, 01:22 AM)ichabod801 Wrote: It looks you are coding in Python 3.0+. If that's the case, input returns a string. So fact is a string and you are comparing it to an integer, and they will never be equal. You either need to convert face to an integer with int(), or you need to compare it to a string ('1').

I've done:
fact= input()
int(fact)
if fact==1:
    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.')
And I still doesn't give me the if statement if I input one
Reply


Messages In This Thread
Input Question - by BlueberryCoconutMuffin - Oct-17-2017, 11:26 PM
RE: Input Question - by ichabod801 - Oct-18-2017, 01:22 AM
RE: Input Question - by BlueberryCoconutMuffin - Oct-18-2017, 08:26 PM
RE: Input Question - by ichabod801 - Oct-18-2017, 08:43 PM
RE: Input Question - by BlueberryCoconutMuffin - Oct-18-2017, 09:15 PM
RE: Input Question - by nilamo - Oct-18-2017, 09:37 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  input function question barryjo 12 2,916 Jan-18-2022, 12:11 AM
Last Post: barryjo
Big Grin General programming question (input string)[ jamie_01 2 1,673 Jan-08-2022, 12:59 AM
Last Post: BashBedlam
Exclamation question about input, while loop, then print jamie_01 5 2,780 Sep-30-2021, 12:46 PM
Last Post: Underscore
  an input question saratha 4 2,135 Jul-15-2020, 04:01 AM
Last Post: ndc85430
  A question about subprocess taking input from command line and returning output! Aurimas 8 5,338 May-15-2019, 04:02 PM
Last Post: Aurimas
  User input question linuxnoob 9 5,076 Jul-12-2018, 01:56 PM
Last Post: linuxnoob
  Beginner question: help ensuring input is a number ycrad 2 2,980 Dec-23-2017, 10:49 PM
Last Post: snippsat
  Basic input() function question rebubula76 2 3,300 Nov-27-2017, 08:12 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020