0% found this document useful (0 votes)
4 views2 pages

Python - Basics 1

aa

Uploaded by

maksym.tret
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Python - Basics 1

aa

Uploaded by

maksym.tret
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Python – Basics 1 Assignments

WELCOME TO PYTHON!

1. Create a Python program with the title “FirstProgram.” In this program, create 8 variables (2 each
of int, float, string & Boolean) and have the program print all values to the console.

<COPY AND PASTE THE SOURCE CODE FOR THE PROGRAM HERE>

<INSERT SCREENSHOTS OF THE PROGRAM AFTER RUNNING>

2. Solve for the value of these variables as they would be found in Python programming. Show all the
steps in the same way used on page 12 of the notes and be sure the result is the correct type:

apple = 2 – 5 * -1 % (15 / 2)

apple = -9.5

banana = (63 % 4) // 2.5

banana =

carrot = 2.6 ** 2 + ((5 / 4) * (3 % 16))

carrot =

3. Create a Python program with the title “FirstMath.” In this program, create 3 variables that are
integers of your choosing named length, width and height. Then create two variables that are floats
called pi (3.14) and a radius of your choosing. Then uses these variables to calculate the area of a
circle (pi*r^2), the area of a rectangle (l * w), the volume of a prism (l * w * h), the surface area of
the prism (4 * (l*w) + 2* (w * h)) and the volume of a sphere (4/3*pi*r^2). Have the program print
these values to the console. Add comments to each calculation line to say what those lines are
doing.

<COPY AND PASTE THE SOURCE CODE FOR THE PROGRAM HERE>

<INSERT SCREENSHOTS OF THE PROGRAM AFTER RUNNING>

Exploring Computer Science


Python – Basics 1 Assignments
4. Create a Python program with the title “CheckPlease.” In this program, create a variable called bill
with a value of your choosing, a variable called tax with a value of 8%, and a variable called tip with
a percentage of your choosing. Then calculate the amount of the bill after tax and print it. Then
calculate the amount of the bill after tax AND tip and print it (tax added first and then tip). Also,
print strings between the values so that we know what each one is. Also, add comments for each
step of the calculation to describe what that line is doing.

<COPY AND PASTE THE SOURCE CODE FOR THE PROGRAM HERE>

<INSERT SCREENSHOTS OF THE PROGRAM AFTER RUNNING>

Exploring Computer Science

You might also like