0% found this document useful (0 votes)
19 views1 page

Class 16 Input and Output

In Python 2, there are two functions for reading dynamic input: raw_input() and input(). In Python 3, only input() is available, which behaves like raw_input() from Python 2, treating all input as strings. The eval() function can evaluate strings as code, allowing for dynamic calculations based on user input.

Uploaded by

kunala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views1 page

Class 16 Input and Output

In Python 2, there are two functions for reading dynamic input: raw_input() and input(). In Python 3, only input() is available, which behaves like raw_input() from Python 2, treating all input as strings. The eval() function can evaluate strings as code, allowing for dynamic calculations based on user input.

Uploaded by

kunala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

In python 2 there are 2 functions are available to read dynamic input from the

keyboard.

1.raw_input()
[Link]()

india nai tiobk batuibkeej ubd indian arngudfoaoddofhsdsoihfodhfvx jjsddgf

10--->int
'scodeen'--->str
10.5--->float

Note:- But in python3 we have only input() method and eaw_input() method is not
available.

python 3 input() function behaviour exactly same as raw_input() method of py2 that
is every input value is treated as str type only.

Note:- raw_input function of python 2 is renamed as input() function in python3.

eval():- evaluate

eval function take a string and evaluate the result.

ex:-
x = eval(input('First number:'))
y = eval(input('second number'))
print(x+y)

india nai tiobk batuibkeej ubd indian arngudfoaoddofhsdsoihfodhfvx jjsddgf

10--->int
'scodeen'--->str
10.5--->float

Note:- But in python3 we have only input() method and eaw_input() method is not
available.

python 3 input() function behaviour exactly same as raw_input() method of py2 that
is every input value is treated as str type only.

Note:- raw_input function of python 2 is renamed as input() function in python3.

Output:-

we can write print() function to display output

You might also like