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
Sur cette page du site, vous pouvez voir la vidéo en ligne Python Tutorial 5: Raw_Input (User Input) durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur JAA228 22 novembre 2011, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 36,214 fois et il a aimé 119 téléspectateurs. Bon visionnage!