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
На этой странице сайта вы можете посмотреть видео онлайн Python Tutorial 5: Raw_Input (User Input) длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь JAA228 22 Ноябрь 2011, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 36,214 раз и оно понравилось 119 зрителям. Приятного просмотра!