This video covers how to read in information from user input and store it to a variable. Then we use that variable to display the user input on the screen. Also, it covers type casting where we convert a string variable into an integer variable. Finally, we learn how to create a new Python script. Demonstrated on Mac OS X.
Please comment, rate, and subscribe ;)
Links:
http://www.python.org/download - Download Python
Code:
#store the user input to a variable called 'name'
#raw_input returns a string
name = raw_input("What is your name? ")
#store the user input to a variable called number
#int converts the string to an integer
number = int(raw_input("How many apples were picked today? "))
#display 'Hello blank!" where the user input replaces the blank
print "Hello %s!" %name
On this page of the site you can watch the video online Python Tutorial 5: Raw_Input (User Input) with a duration of hours minute second in good quality, which was uploaded by the user JAA228 22 November 2011, share the link with friends and acquaintances, this video has already been watched 36,214 times on youtube and it was liked by 119 viewers. Enjoy your viewing!