2- input always returns string.
Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> x=input(enter a number)
SyntaxError: invalid syntax
>>> x=input ("enter a number")
enter a number100
>>> print(x)
100
>>> z=input()
500
>>> z
'500'
>>> type(Z)
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
type(Z)
NameError: name 'Z' is not defined
>>> type(z)
<class 'str'>
>>> z=int(input())
799
>>> z
799
>>> type(z)
<class 'int'>
>>>
Comments
Post a Comment