$30
1
CIS 122 Project 1
Use Python 3 for all projects this term.
Submit your Python 3 .py programs to Canvas.
20 points total
General Hint
Look in Canvas for Files Examples for similar programs
P1_hello.py 7 points
2 points
1) Print "Hello World" then print a blank line
3 points
2) Experiment with variables and "literals"
Assign your first name to a name variable
print( "name")
print (name)
What does each print ?
# Make a comment with your conclusions
3 points
3) Print a blank line
Assign a phrase to the variable ambition
then print the ambition variable
Your output should look similar to this
P1_numbers.py 4 points
2 points -- Raise a big integer to a power
1) Assign 123456789 to the variable x
Assign 444 to the variable y
2) Compute the variable z as x to the y power; print z
Hint:
answer = 4 ** 3 # Computes answer as 4 to the 3 power
3) Add a comment to your program
Did you get z computed, or did you get an error message?
2 points -- Raise a big floating point number to a power
1) Assign 123456789.0 to the variable a_float
Assign 44 to the variable b
2) Compute the variable c as a_float to the b power
3) Add a comment to your program
Did you get c computed, or did you get an error message?
Your output will look like this:
...
The next part of your project lets you see some results without
needing to know a lot of Python.
Never save a file called "turtle.py" – if you do so, turtle graphics
will not work on your computer until you change the name to
something else.
First
Be sure to include this statement before the rest of your program:
import turtle as t
Other useful "turtle" commands
t.pencolor("green") # Use any common color name
t.pensize(2) # Make lines wider
t.forward(50) # Move forward 50 units
t.left(60) # Turn left 60 degrees,
# Turtle does not move, just turns
t.penup() # Lifts pen up for no visible
# marks when moving
t.pendown() # Sets pen down; move forward
# will make a mark
P1_draw.py 9 points
4 points
Set the pen's color to "red".
Draw a square, each side 100 pixels long.
1 point
Move forward 150 pixels without making a mark.
4 points
Set the pen's color to "blue".
Set the pen's size to 3.
Draw a square, each side 120 pixels long.
Your drawing will look like this when run:
Before you submit your .py files, test each one.
Submit your .py files in Canvas Assignments P1