LESSON 2: PYTHON VARIABLES
Send the answers to me as a PDF! Make sure to put the right
question numbers in your answers 👏
Do all of these questions without using a Python Compiler
1. x = 45
x=x*2+1
What is the new value of x?
2. 45age = 12
Would this throw an error? If yes or no, why?
3. x = 5
y=6
y=x+y
x=y+1
print(x)
print(y)
What is the output of the above code? Make sure to list
some calculations you did to find the answer.
4. x = x + 3
y=4+2
x=y
What is the output of the above code? Make sure to list
some calculations you did to find the answer.
5. x = 10
y = 20
z=x-y
print(x)
print(y)
print(z)
y=z*x
x=y*z
print(x)
print(y)
print(z)
What is the output of the above code? Make sure to list
some calculations you did to find the answer.
6. y = 10
x = 12 * y
print(x)
print(y)
y=x
print(x)
print(y)
What is the output of the above code? Make sure to list
some calculations you did to find the answer.
7. y = 15
x=y
x=x+7
print(x)
print(y)
x=y
y = 25
print(x)
print(y)
What is the output of the above code? Make sure to list
some calculations you did to find the answer.
8. revenue = 200
expenses = 400
Profit = -200
Represent the profit variable using revenue and expense
variables. What is the benefit of having the profit variable
based on revenue and expense variables instead of a -200
value?
Similarly try to represent the revenue variable using
expenses and profit variables.
Again try to represent the expenses variable using
revenue and profit variables.
DONE 🎉🎉