Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Lab 01 - Calculator/lab_01_part_a.py
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
#
#!/usr/bin/env python3
#lab_01_part_1.py
#Justin Riebow
#11/2/17

"""Asks the user for temperature in fahrenheit and converts it to celsius"""

fahrenheit = int(input("Enter temperature in Fahrenheit: "))
print("The temperature in Celsius:", (float((fahrenheit - 32) * 5/9)))
14 changes: 13 additions & 1 deletion Lab 01 - Calculator/lab_01_part_b.py
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
#
#!/usr/bin/env python3
#lab_01_part_b.py
#Justin Riebow
#11/2/17

"""Prints area of trapezoid"""

print("Area of a trapezoid")
trapezoidHeight = int(input("Enter the height of the trapezoid: "))
trapezoidBottomLength = int(input("Enter the length of the bottom base: "))
trapezoidTopLength = int(input("Enter the lenght of the top base: "))
trapezoidArea = (0.5 * (trapezoidBottomLength + trapezoidTopLength) * trapezoidHeight)
print("The area is:", (trapezoidArea))
14 changes: 13 additions & 1 deletion Lab 01 - Calculator/lab_01_part_c.py
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
#
#!/usr/bin/env python3
#lab_01_part_c.py
#Justin Riebow
#11/2/17

"""Finds the area of a circle"""

from math import pi
print("Area of a circle")
circleRadius = int(input("Enter the radius of the circle: "))
circleArea = pi*circleRadius**2
print(circleArea)

70 changes: 69 additions & 1 deletion Lab 03 - Create a Quiz/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,69 @@
#
#!/usr/bin/env python3
#main_program.py
#Justin Riebow
#11/3/17

"""A quiz that asks questions for the user to answer"""

average = 0


print("Find the sum of: 2(15 + 12) * 4")
answerQ1 = int(input("Answer: "))
if answerQ1 == 216:
average += 1
print("Correct!")
else:
print("Incorrect!")

print("Who was the 16th president of the United States?\nA: George Washington\nB: Abraham Lincoln\nC: Donald Trump\nD: Thomas Jefferson")
answerQ2 = input("Answer: ")
if answerQ2.lower() == "b":
average += 1
print("Correct!")
elif answerQ2.lower() == "c":
print("... Are you serious?")
q2seriously = input("Y/N: ")
if q2seriously.lower() == "y":
print("How unfortunate. Next Question.")
else:
print("Then who is the 16th president?")
q2seriouslyanswer = input("Answer: ")
if q2seriouslyanswer.lower() == "abraham lincoln":
average += 1
print("Good. Next question.")
else:
print("You disgust me. Next question.")
else:
print("Incorrect!")

print("What is the capital of Illinois?")
answerq3 = input("Answer: ")
if answerq3.lower() == "springfield":
average += 1
print("Correct!")
else:
print("Incorrect!")

print("You are running a race and you passed the person in second place. What place are you in now?")
answerq4 = input("Answer(without using numbers): ")
if answerq4.lower() == "second" or answerq4.lower() == "second place":
average += 1
print("Correct!")
else:
print("Incorrect!")

print("In League of Legends, what is the name of Yasuo's ultimate ability?\nA: Last Breath\nB: Wind Slash\nC: Slice and Dice\nD: Exodia")
answerq5 = input("Answer: ")
if answerq5.lower() == "a":
average += 1
print("Correct!")
elif answerq5.lower() == "d":
print("Incorrect! Completely different game, but nice try!")
else:
print("Incorrect")

averagePercent = (average/5) * 100
print("You got", str(average), "correct.")
print("You got", averagePercent, "percent on this quiz.")

91 changes: 90 additions & 1 deletion Lab 04 - Camel/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,90 @@
#
#!/usr/bin/env python3
#main_program.py
#Justin Riebow
#11/3/17

"""bring your car far away enough from the cops to escape before they catch you"""

import random
done = False
userMiles = 0
copMiles = 0
fuel = 8
thirst = 5
money = 3

print("Welcome to Drive!\nYou have stolen a car to make your way to California.\nThe cops found out and are chasing you down!\nSurvive your road trek and outrun the cops.")
while done == False:
print("A. Grab a drink at the gas station.\nB. Ahead moderate speed.\nC. Ahead full speed\nD. Stop and fuel up\nE. Status check.")
choice = input("Your choice?: ")
if choice.lower() == "q":
done = True
if choice.lower() == "a":
money = money - 1
thirst = 5
copMiles = copMiles + random.randint(10, 20)
print("You take a drink.\nYou have enough money for", str(money), "more drinks.")
elif choice.lower() == "b":
userMiles = userMiles + random.randint(7,14)
fuel = fuel - 1
copMiles = copMiles + random.randint(3, 11)
thirst = thirst - 1
if thirst == 2:
print("You are thirsty.")
if thirst == 0:
done = True
print("You fainted from dehydration.")
print("You travel at moderate speed.")
if copMiles >= userMiles - 20:
print("The cops are getting close!")
if copMiles >= userMiles:
print("The cops caught you!")
done = True
if fuel <= 2:
print("You are almost out of fuel!")
if fuel <= 0:
print("You ran out of fuel!")
elif choice.lower() == "c":
userMiles = userMiles + random.randint(15, 22)
fuel = fuel - 2
copMiles = copMiles + random.randint(5, 12)
thirst = thirst - 1
if thirst == 2:
print("You are thirsty.")
if thirst == 0:
done = True
print("You fainted from dehydration.")
print("You floor it ahead!")
if copMiles >= userMiles - 11:
print("The cops are getting close!")
if copMiles >= userMiles:
print("The cops caught you!")
done = True
if fuel <= 3:
print("You are almost out of fuel!")
if fuel <= 0:
print("You ran out of fuel!")
done = True
elif choice.lower() == "d":
fuel = 8
copMiles = copMiles + random.randint(10, 20)
print("You fuel up at a gas station")
elif choice.lower() == "e":
print("Miles traveled:", str(userMiles))
print("How many more drinks you have enough money for:", str(money))
if thirst >= 4:
print("You are not thirsty.")
if thirst == 3:
print("You are slightly thirsty.")
if thirst == 2:
print("You are thirsty.")
if thirst == 1:
print("You need to drink something ASAP.")
if userMiles >= 200:
copMiles == copMiles - 200
done = True
print("Congratulations! You escaped the cops!")




40 changes: 39 additions & 1 deletion Lab 05 - Create a Picture/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,39 @@
#
#!/usr/bin/env python3
#main_program.py
#Justin Riebow
#11/7/17

"""A pretty picture"""

import pygame

yellow = (235, 244, 66)
lightBlue = (66, 131, 244)
green = (0, 142, 60)
brown = (49, 53, 0)
black = (0, 0, 0)

pygame.init()

size = (700, 500)
screen = pygame.display.set_mode(size)

pygame.display.set_caption("Rainy Day")

done = False

clock = pygame.time.Clock()

while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
screen.fill(lightBlue)
pygame.draw.rect(screen, green, [0, 400, 700, 100 ])
pygame.draw.rect(screen, brown, [250, 200, 200, 200])
pygame.draw.polygon(screen, brown, [[350, 100],[250, 200], [450, 200]])
pygame.draw.rect(screen, black, [325, 325, 50, 75])
pygame.draw.ellipse(screen, yellow, [20, 20, 100, 100])
pygame.display.flip()
clock.tick(60)
pygame.quit()
12 changes: 12 additions & 0 deletions Lab 06 - Loopy Lab/part_1.py
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
#!/usr/bin/env python3
#part_1.py
#Justin Riebow
#11/15/17

"""Prints out numbers in a certain order"""

i = 10
for row in range(1, 10):
for column in range(row):
print(i,end=" ")
i += 1
print()
21 changes: 20 additions & 1 deletion Lab 06 - Loopy Lab/part_2.py
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
#
#!/usr/bin/env python3
#part_2.py
#Justin Riebow
#11/16/17

"""Creates a box made of o's"""

#Make an input for the number of o's in a row
row = int(input("Enter number: "))
#Draws top line
for toprow in range(row*2):
print("o", end="")
print()
#Draws side
for side in range(row-2):
print("o", (row-2) * " ", "o")
#Draws bottom line
for bottomrow in range(row*2):
print("o", end="")
print ()
44 changes: 43 additions & 1 deletion Lab 06 - Loopy Lab/part_4.py
Original file line number Diff line number Diff line change
@@ -1 +1,43 @@
#
#!/usr/bin/env python3
#part_4.py
#Justin Riebow
#11/16/17
"""Create an image using small rectangles"""

import pygame

BLUE = (0,0,255)
BLACK = (0,0,0)

pygame.init()

size = (500, 500)
screen = pygame.display.set_mode(size)

pygame.display.set_caption("My Game")

done = False

clock = pygame.time.Clock()

while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True


screen.fill(BLACK)

for y in range(0, 500, 20):
for x in range(0, 500, 20):
pygame.draw.rect(screen, BLUE, (x, y, 10, 10))

pygame.display.flip()


clock.tick(60)

pygame.quit()



Loading