Computer Science

Find the errors in following code fragment:


a = input("value")
b = a/2
print (a, b)

Python Funda

36 Likes

Answer

The input( ) function always returns a value of String type so variable

a
is a string. This statement b = a/2 is trying to divide a string with an integer which is invalid operation in Python.

Answered By

19 Likes


Related Questions