0
why i us: a=float(input()) a=a+10 print(a) is correct but when i use a=a+10 a=float(input()) print=(a) is wrong. I need a answer
pls help me
4 odpowiedzi
+ 6
Dang Yuh ,
when using (solely) the second code there are 2 other issues:
a=a+10 # creates a NameError since variable a is not defined
print=(a) # does not output anything, it overwrites the built-in print() function by making it a variable.
+ 2
a=float(input())
a=a+10
print(a)
a=a+10
a=float(input())
print=(a)
In the first case, you are asking for input and setting that to a. Then adding ten to that.
In the second case you are adding 10 to a, but then setting a to the input, thus replacing whatever was in a.
0
tks guys