Computer Studies‎ > ‎Python‎ > ‎Python Tutorial‎ > ‎

Keyboard Input -- Strings

Recall that to enter a whole number from the keyboard you used a command similar to:

mark = int(input("What mark did you get?" ))

If you were to enter a string in response to that input command you would get an error. The solution is to simply not do the type conversion, as shown in this example:

name = input("What is your name?" )

Assignment

Modify program 018 so it also prompts for and prints your birth location. 

Save as "018a.py".
Comments