Q. Consider below given two sets of codes, which are nearly identical, along with their execution in Python shell Notice that first code fragment after taking input gives error, while second code-fragment not produce error. Can you tell why?


>>> print(num = float(input("value:")) )
value:67
Traceback (most recent call last):
File "ipython-input-56-78b83d911bc6>", line 1, in <modules
print(num= float (input("value:")))

Type Error: 'num is an invalid keyword argument for this function

>>>print(float(input("value1 :")))

value1:67
67.0

Answer =

Because we can not define variable in print function.

2 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post