Python Tutorial 5: Raw_Input (User Input)

preview_player
Показать описание
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:

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
Рекомендации по теме
Комментарии
Автор

I'm just now taking programming in college, and we're working with python. Make more!!! Great videos.

ZTRussell
Автор

Great tutorial!! hope you can upload more...THANK YOU!

corrinewu
Автор

For Python version 3.6.1, the code should be as following:

name = input ("What is your name?")
print ("Hello %s" % name)

Thanks for the tutorial JAA228

nashcasper
Автор

pls make more you have been very very very helpfull!!!!
MORE MORE MORE !!!!

Wolfbite
Автор

pleaseee make more. soo helpful!! Thanks so much.

josiehuang
Автор

Thanks for help, i really needed it...

mishoaleksidze
Автор

Nice! Never knew you could save an input in a variable. Is there any way you could save the input in a permanent variable even if you reset "the blank window"? Hope it makes sense

BBeastAVMan
Автор

What is the "int" before the raw_input? In some examples, there is ''Int(raw_input())

paulrichard
Автор

How do you change the color of the text that you input?

andDONEson
Автор

Another way to do this

name = raw_input ("What is your name?")
print "Hello %s." % (name)

williamwordsworth
Автор

If youre using Version 3 of python there is no longer and raw_input only input

kastor
Автор

I don't know how to do this on python 3, it won't work.

silverpylorc
Автор

When i so the raw_input it says it isnt defined
 

CowsInHats
Автор

when I try this, it just comes back with 'raw_input is now defined

gnarlynarwhal
Автор

for me it's saying 'raw_input' is not defined

madhumita
welcome to shbcf.ru