Python 13.1 LESSON | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python 13.1 LESSON

How to solve it, I can’t get it & where the answer comes out. Help pls. Guess the output of this code: Age = 42 Age = 24-6 Print(age)

4th Mar 2022, 12:44 PM
Juan
5 Answers
+ 4
The last value of the variable(age) is 24 - 6, so the answer is what you get when you subtract 6 from 24. To understand why that is the answer, you need to understand how Python reads and executes code. Python reads the code from top to bottom, meaning that in cases like this one, where the same variable is equated to 2 values, Python will only consider the last value of the variable; in this case that is 24 - 6. If you need further explanation feel free to ask.
4th Mar 2022, 1:08 PM
Tawananyasha Chinoda
Tawananyasha Chinoda - avatar
+ 3
Python is sensitive language so that "age" is different from "Age". You can change print(age) by print(Age).
6th Mar 2022, 8:59 AM
Ueda
+ 2
Question is confusing. Where did you find that code and why do you think it would give 1 as output?
4th Mar 2022, 12:55 PM
Seb TheS
Seb TheS - avatar
+ 2
The answers are expected of a print statement/s. In yor code for example with: print(age)
4th Mar 2022, 1:06 PM
JaScript
JaScript - avatar
+ 1
18
3rd Nov 2022, 5:34 AM
Mustafa Cagri Altin
Mustafa Cagri Altin - avatar