Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with raw_input
#2
Please use python tags (https://python-forum.io/misc.php?action=help&hid=25). I added them for you this time.

The problem is that you need parens after lower, like so:

how_are = raw_input('How are you? ').lower()
That's how you call a function or method to get the value it produces. The way you have it, how_are ends up being the lower method itself. Note this oddity:

>>> x = 'SPAM'.lower
>>> x()
'spam'
After the first line, x is the method itself, and displays as nothing. We can then call x, by using parentheses, to get the result we were looking for. But do it the first way I showed you. The second way is just silly.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
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,366 Jul-14-2020, 02:19 PM
Last Post: BitPythoner
  raw_input vs input EmilySenechal 1 2,432 Nov-20-2018, 02:13 AM
Last Post: ichabod801
  raw_input rtbr17 3 3,779 Sep-26-2018, 09:36 PM
Last Post: nilamo
  URL via raw_input, passed to HTTP requests and output? johnnyaustin 1 5,006 Dec-08-2017, 11:22 PM
Last Post: johnnyaustin
  Cmd Module + raw_input tab [complete ruggierom 1 3,572 Feb-06-2017, 12:43 AM
Last Post: ruggierom
  Any way to get raw_input to work in my function? Pythonerous 4 5,389 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