Sunday, 25 January 2015

Python 3.4.2 Part 5 Using input tutorial

>>> x=input("Enter a string")
Enter a string ayman
>>> x
' ayman'
>>> y=input("Enter your name: ")
Enter your name: Ayman
>>> x
' ayman'
>>> y
'Ayman'
>>> x=input("Enter a string")
Enter a string5
>>> x
'5'
>>> y=int(input("Enter a number"))
Enter a number8
>>> y
8
>>> y+int(x)
13



Now why we got an error in y+x??
please comment the reason

No comments:

Post a Comment