Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with raw_input
#1
I have this as a sample code but my questions of 'How are you?' and 'Do you like computers?' do not return the correct answers to my input. Any help would be great Smile



q_name = raw_input('What is your name?  ')
    print 'Hello %s.' %q_name

how_are = raw_input('How are you?  ').lower
if how_are == 'good' or how_are =='great' or how_are =='fantastic':
    print 'Im glad to hear.'
elif how_are == 'bad' or how_are == 'not good' or how_are == 'awful':
    print 'Im sorry to hear'
else:
    print "I am sorry, I am a computer and don't have emotions."


q_comp = raw_input('Do you like computers?  ').lower
if q_comp == 'yes':
    print 'Awesome!'
else:
    print "That's dumb"
Reply


Messages In This Thread
Help with raw_input - by Marshall_99 - Mar-21-2017, 01:10 AM
RE: Help with raw_input - by ichabod801 - Mar-21-2017, 01:38 AM
RE: Help with raw_input - by Marshall_99 - Mar-21-2017, 01:44 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Going thru tutorials..."NameError: name 'raw_input' is not defined" hmonnier 4 4,298 Jul-14-2020, 02:19 PM
Last Post: BitPythoner
  raw_input vs input EmilySenechal 1 2,406 Nov-20-2018, 02:13 AM
Last Post: ichabod801
  raw_input rtbr17 3 3,736 Sep-26-2018, 09:36 PM
Last Post: nilamo
  URL via raw_input, passed to HTTP requests and output? johnnyaustin 1 4,935 Dec-08-2017, 11:22 PM
Last Post: johnnyaustin
  Cmd Module + raw_input tab [complete ruggierom 1 3,532 Feb-06-2017, 12:43 AM
Last Post: ruggierom
  Any way to get raw_input to work in my function? Pythonerous 4 5,327 Oct-27-2016, 05:03 PM
Last Post: Pythonerous

Forum Jump:

User Panel Messages

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