Main.Input History
Hide minor edits - Show changes to markup
January 24, 2010, at 05:05 PM MST
by -
Added line 3:
Changed lines 6-7 from:
- There are two built-in functions in Python for getting keyboard input:
to:
- There are two built-in functions in Python for getting keyboard input
- when you want to read a string a string use the "raw_input" function:
Changed lines 10-19 from:
print name
to:
print "name has a type", type(name)
- when you want to read numbers use the "input" function:
age = input("your age? ") print "age has a type", type(age)
print name, "says he is", age, "years old"
- if you enter an expression using input, python evaluates it:
Added lines 22-26:
- you can enter a string using input, but you have to surround it
- with quotes
string = input("please enter a string: ") print type(string)
January 21, 2010, at 01:38 PM MST
by -
Added lines 1-12:
(:source lang=python:)
"""Getting input from the user"""
- There are two built-in functions in Python for getting keyboard input:
name = raw_input("Please enter your name: ") print name expression = input("Enter a numerical expression: ") print expression
(:sourceend:)
