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
9 changes: 8 additions & 1 deletion Lab 01 - Calculator/lab_01_part_a.py
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
#
#!/usr/bin/env python3
#Fahrenheit to Celsius conversion
#Ryan Rosvall
#11/1/17

temperature = int(input("Enter temperature in Fahrenheit: "))
conversion = ((temperature - int(32)) * 5/9)
print('The temperature in Celsius: ' + str(conversion))
12 changes: 11 additions & 1 deletion Lab 01 - Calculator/lab_01_part_b.py
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
#
#!/usr/bin/env python3
#Trapezoid Area Calculator
#Ryan Rosvall
#11/1/17

print('Area of a trapezoid')
height = int(input('Enter the height of the trapezoid: '))
lengthBottom = int(input('Enter the length of the bottom base'))
lengthTop = int(input('Enter the length of the top base: '))
calculation = (1/2) * (lengthBottom + lengthTop) * height
print('The area is: ' + str(calculation))
9 changes: 8 additions & 1 deletion Lab 01 - Calculator/lab_01_part_c.py
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
#
#!/usr/bin/env python3
#Circle Area Calculator
#Ryan Rosvall
#11/1/17

number = int(input('Enter the radius: '))
calculation = (3.14) * number ** 2
print('Area of circle: ' + str(calculation))
13 changes: 12 additions & 1 deletion Lab 02 - Computer History/Chapter 2 report on video.docx
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
Report goes here
Ryan Rosvall
11/9/17

Lab 2: Computer History

Paul Alan and Bill Gates ran a company called Microsoft. They together invented the personal computer. It all happened by accident because they wanted to impress their friends. They never thought it would have went far, they just wanted to mess around and create something new. This all started in Silicon Valley, created by middle class white kids in their garage. Technology is always getting more and more advanced. The original creators of Apple didn't have a time schedule. They coded when they wanted and they always worked well because they liked each other. At first people didn't really care about computers but there was always that one kid who fell in love with it and got into it.

Back then the idea of putting text into a computer and having it make an outcome was mind boggling. The first computers were huge because they were filled with vacuum tubes which later got replaced with transistors but they were still too big to make a computer on your desk. Finally there was a final piece made called the CPU which made it work all together in a small form. The people who invented the microprocessor was Intel. They power 85% of the worlds computers. The Altair 8800 was the first personal computer. But people really couldn't get their hands on it.

Ed Roberts wanted to create his own personal computer that you could buy. This was created far far away from silicon valley, IBM, or Intel out in the desert in Albuquerque New Mexico, in a building that was very runned down. Ed Roberts was running a calculator company named Mitts that was going very bad. Nobody was buying his calculators and he was going bankrupt. He needed 65k dollars just to stay afloat. When he created this machine, people were camping out and waiting for it over night. There was a huge demand for this computer and it saved his company.

Apple started to have explosive growth. The company had more money than they could spend. The company was extremely young too, most workers being around 20 years old. The apple II set a new standard for personal computers. They needed a killer application, this application was called visical. Dan Brickland created the first electronic spreadsheet. It was able to calculate years ahead depending on your inputs and was way advanced for its time. This was planned to calculate things in your budget and make it easier on you.
77 changes: 76 additions & 1 deletion Lab 03 - Create a Quiz/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,76 @@
#
#!/usr/bin/env python3
#Quiz
#Ryan Rosvall
#11/1/17

print('Quiz time!')
totalRight = 0
print()
questionOne = input('The beaver is the national emblem of which country? ')
if questionOne == 'Canada' or questionOne == 'canada' or questionOne == 'CANADA':
print()
print('Correct!')
print("You've gained a point! Great job!")
print()
totalRight = totalRight + 1
else:
print()
print('WRONG!, The correct answer is Canada.')
print()

questionTwo = input('Who is the director of the Lord of The Rings trilogy? ')
if questionTwo == 'Peter Jackson' or questionTwo == 'peter jackson' or questionTwo == 'PETER JACKSON':
print()
print('Good Job!')
print('Thats another point to your total!')
totalRight = totalRight + 1
else:
print()
print('WRONG! The correct answer is Peter Jackson')

print()
print('Next Question!')

questionThree = input('What is 9 * 9? ')
if questionThree == str(81):
print()
print('Good Job!')
totalRight = totalRight + 1
if totalRight == 3:
print("YOU'RE ON FIRE!!!")

else:
print()
print('WRONG! The correct answer is 81')

print()
print('How many cities are in Missouri? ')
a = print('a = 108')
b = print('b = 121')
c = print('c = 105')
d = print('d = 117')
print()
questionFour = input('Choose your answer: ')
if questionFour == "c":
print()
print('Outstanding!')
totalRight = totalRight + 1
else:
print()
print('WRONG! The correct answer is c.')

print()
print('Next Question!')
questionFive = input('Al Capone was sentenced to 11 years in prison for what crime? ')
if questionFive == 'Tax Evasion' or questionFive == 'tax evasion' or questionFive == 'TAX EVASION':
print()
print('Good Job!')
totalRight = totalRight + 1
else:
print()
print('WRONG! The correct answer is Tax Evasion')

print()
print('The amount you got right was: ' + str(totalRight) + '/5')
print()
print('Your % was ' + str((totalRight/5) * 100))
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
#Camel Program
#Ryan Rosvall
#11/2/17

import random

milesTraveled = 0
thirst = 0
camelTiredness = 0
nativeDistance = -20
canteenDrinks = 3



print("Welcome to Camel!")
print("You have stolen a camel to make your way across the great Mobi desert.")
print("The naties want their camel back and are chasing you down! Survive your dsesert trek and out rin the natives.")
print()
done = False
while done == False:
print("A. Drink from your canteen.")
print("B. Ahead moderate speed.")
print("C. Ahead full speed.")
print("D. Stop for the night.")
print("E. Status check.")
print("Q. Quit.")
choice = input("Your choice? ").upper()
print()
if thirst >= 6:
if choice != "A":
print("You died of thirst!")
done = True
elif thirst > 4:
if choice != "A":
print("You are thirsty.")
if camelTiredness > 8:
if choice != "D":
print("Your camel is dead.")
done = True
elif camelTiredness > 5:
if choice != "D":
print("Your camel is getting tired.")
if nativeDistance > milesTraveled:
print("The natives caught you.")
done = True
if nativeDistance < 15:
print("The natives are getting close.")
if milesTraveled == 200:
print("You won!")
done = True
if choice == "Q":
done = True
elif choice == "E":
print("Miles traveled: " + str(milesTraveled))
print("Drinks in canteen: " + str(canteenDrinks))
print("The natives are " + str(milesTraveled - nativeDistance) + " miles behind you.")
print()
elif choice == "D":
camelTiredness = 0
print("Your camel is happy :)")
print()
elif choice == "C":
m = random.randint(10, 20)
milesTraveled = milesTraveled + m
print("You traveled " + str(m) + ' miles')
camelTiredness = camelTiredness + random.randint(1, 3)
thirst = thirst + 1
n = random.randint(7, 14)
nativeDistance = nativeDistance + n
print('The natives moved ' + str(n) + ' miles')
print()
elif choice == "B":
m = random.randint(5, 12)
milesTraveled = milesTraveled + m
print("You traveled " + str(m) + " miles.")
thirst = thirst + 1
camelTiredness = camelTiredness + 1
n = random.randint(5, 8)
nativeDistance = nativeDistance + n
print('The natives moved ' + str(n) + ' miles')

print()
elif choice == "A":
if canteenDrinks > 0:
canteenDrinks = canteenDrinks - 1
thirst = 0
else:
print("You cannot drink from your canteen because it is empty.")

62 changes: 61 additions & 1 deletion Lab 05 - Create a Picture/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,61 @@
#
#!/usr/bin/env python3
#Picture game
#Ryan Rosvall
#11/3/17

import pygame

pygame.init()

black = (0, 0, 0)
white = (255, 255, 255)
green = (0, 255, 0)
red = (255, 0, 0)

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

pygame.display.set_caption("Ryan's Super Cool Drawing Game")

done = False

clock = pygame.time.Clock()

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


screen.fill(white)

pygame.draw.rect(screen, black, [150, 150, 350, 300])

#for x in range(0, 100, 20):
for x in range(150, 350, 50):
pygame.draw.line(screen, black, [150, 150], [350, 100], 5)
pygame.draw.line(screen, black, [150, 158], [350, 108], 2)
pygame.draw.line(screen, black, [150, 166], [350, 116], 2)
pygame.draw.line(screen, black, [150, 174], [350, 124], 2)
pygame.draw.line(screen, black, [350, 150], [350, 100], 5) #downline

font = pygame.font.Font(None, 20)

text = font.render('Pg.9', True, black)
screen.blit(text, [315,135] )


pygame.draw.ellipse(screen, green, [350, 350, 40, 40])
pygame.draw.ellipse(screen, green, [250, 350, 40, 40])
pygame.draw.rect(screen, white, [250, 250, 140, 100])
pygame.draw.rect(screen, white, [380, 300, 50, 50])

#pygame.draw.rect(screen, black, [50, 50, 250, 100]

pygame.display.flip()


clock.tick(20)

pygame.quit()

8 changes: 7 additions & 1 deletion Lab 06 - Loopy Lab/part_1.py
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@

num = 10
for row in range(10):
number = ""
for i in range(row):
number += str(num) + " "
num += 1
print(number)
12 changes: 11 additions & 1 deletion Lab 06 - Loopy Lab/part_2.py
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
#
n = int(input("Enter your number of o's: "))

for row in range(n * 2):
print("o", end = '')
print()

for rowLeft in range(n-1):
print("o" + " " * ((n*2) -2) + "o")

for rowBottom in range(n * 2):
print("o", end = '')
67 changes: 66 additions & 1 deletion Lab 06 - Loopy Lab/part_4.py
Original file line number Diff line number Diff line change
@@ -1 +1,66 @@
#
"""
Pygame base template for opening a window

Sample Python/Pygame Programs
Simpson College Computer Science
http://programarcadegames.com/
http://simpson.edu/computer-science/

Explanation video: http://youtu.be/vRB_983kUMc
"""

import pygame

# Define some colors
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)

pygame.init()

# Set the width and height of the screen [width, height]
size = (700, 500)
screen = pygame.display.set_mode(size)

pygame.display.set_caption("My Game")

# Loop until the user clicks the close button.
done = False

# Used to manage how fast the screen updates
clock = pygame.time.Clock()
_draw = False
# -------- Main Program Loop -----------
while not done:
# --- Main event loop
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True

# --- Game logic should go here

# --- Screen-clearing code goes here

# Here, we clear the screen to white. Don't put other drawing commands
# above this, or they will be erased with this command.

# If you want a background image, replace this clear with blit'ing the
# background image.
screen.fill(BLACK)

# --- Drawing code should go here

while not _draw:
for y in range(0, 500, 10):
for x in range(0, 700, 10):
pygame.draw.rect(screen, GREEN, [x, y, 5, 5])
# --- Go ahead and update the screen with what we've drawn.
pygame.display.flip()

# --- Limit to 60 frames per second
clock.tick(60)
_draw = True

# Close the window and quit.
pygame.quit()
Loading