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

Is this what you are looking for?

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

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()
>>>

Also see this thread about the format method for python >= 2.6.

how do i convert String into integer in python 3

commented: Lazy -3

You google "python convert string to integer" and pick one of the 536,000 results instead of asking someone here to do it for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.