Hello All,

I am new in this language and want to access the run time value

In other words, I want make a program in which ask the value from

User like scanf() function in C and cin>> function in Cpp

So is there any function or method by which user can enter value and print on screen

I have made program in which value is define early

>>>l=10
>>>print("Entered  Value is ",l)
>>>Entered Value is 10

Now i want user can enter value at run time and get put

thnanX in advance

this function is not working on my comand line terminal !

Is this what you are looking for?

>>> a= raw_input()
10
>>> print a
10
>>>

Look like you use python 3

>>> #Python3 has only input that return a string
>>> user_input = input('Give me a number: ')
Give me a number: 10
>>> user_input
'10'
>>> type(user_input)
<class 'str'>
>>> print 'Your number was %s' % (user_input)
SyntaxError: invalid syntax (<pyshell#4>, line 1)
>>> print ('Your number was %s' % (user_input))
Your number was 10
>>> #And print has become function print()
>>>

its works

thank you so much !

Look like you use python 3

>>> #Python3 has only input that return a string
>>> user_input = input('Give me a number: ')
Give me a number: 10
>>> user_input
'10'
>>> type(user_input)
<class 'str'>
>>> print 'Your number was %s' % (user_input)
SyntaxError: invalid syntax (<pyshell#4>, line 1)
>>> print ('Your number was %s' % (user_input))
Your number was 10
>>> #And print has become function print()
>>>
This question has already been answered. Start a new discussion instead.