What is `raw_input()`?

What is a raw_input? And why a parenthesis needed after raw_input although python 2 is being used?

1 Like

its a built-in function

calling a function always requires parentheses.


Thank you for your response @stetim94, if you don’t mind could you explain in detail about the usage of raw_input during codding and the difference of a function and a built-in function? Sorry for the trouble, i am a newbie in this

its a built-in function so you can get input from the user.

a function is one you write, a built-in function ships with the python language. They are both functions, so in a sense they are the same


Thank you so much for your help, can i understand the concept of built-in function similar to result keywords such as True = 1, and False = 0 that is fixed with python?

True and False are Boolean’s, but yes, they come bundled with the python language as well.

1 Like

Thank you, @stetim94, this is a question outside of the exercise, but hope you could help with it. What is a signed integer and unsigned integer and how does it effect our code? when is it necessary to use a singed and unsigned integer?

No idea, seems more relevant to C then python:


@stetim94, thanks for the source, say i have completed the course of python, where would you suggest me to proceed in implementing it? Where can i really try to use what i learned?

you can install python on your computer. Which gives you the python IDLE as well as the ability to run python scripts with the interpreter.

@stetim94, can i know what is a python IDLE? And with python downloaded, what can i do with it. What can i create, any ideas?

@stetim94, i just met a problem, the 4 in %04d should means that 4 spacing is allowed, correct? If that is so, then why when i print the date # print ‘%02d/%02d/%01d’ % (now.month, now.day, now.year) the year still shows 4 digits # 2018 although in my code only one digit is allow for year? And i don’t quite understand the use of the d in %02d. I hope you don’t mind my non-stop questions, thank you so much for your response.

IDLE = integrated development and learning enviroment

python is a general purpose programming language, you can do many things. Back-end of a website, scrapers and much more.

i don’t think you can use 01 to display less digits then the variable holds

%d is a placeholder for a decimal variable, just like %s is for a string. Its a good way to insert variables into a string

1 Like

so that means that i can’t make it lesser by using 01 but i can expend it to 4 or more digits example using 05 , is that right. But i can still add a float value using %s although %s is for a string variable example, float1 = 0.3 print ‘This is float1 %s’ % (float1)

yes, exactly

but %s only allow strings, you can’t use floats with %s

1 Like

Why do we not need parentheses when we call the print function in python 2 but we need parentheses for the raw_input function?

1 Like

because in python2 print is not a function, its a statement.


A signed integer is a positive or negative number.
ex: +2 or -2
the positive/negative sign

hi~I have a question need to be solved.My code is same to the answer,why tell me that my code is wrong?

please see this topic:

How to ask good questions (and get good answers)

with the information you currently provided, i can’t help you.