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.
i cannot see answer here
ReplyDeleteOk. We have Fix it.
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )