0% found this document useful (0 votes)
6 views3 pages

Python Variables: Exercises & Outputs

The document contains a series of Python variable exercises that require calculations and outputs based on given code snippets. It includes questions about variable assignments, potential errors, and the relationship between revenue, expenses, and profit. The task is to answer these questions without using a Python compiler and to submit the answers in PDF format.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Python Variables: Exercises & Outputs

The document contains a series of Python variable exercises that require calculations and outputs based on given code snippets. It includes questions about variable assignments, potential errors, and the relationship between revenue, expenses, and profit. The task is to answer these questions without using a Python compiler and to submit the answers in PDF format.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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 🎉🎉

You might also like