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
8 changes: 7 additions & 1 deletion Lab 01 - Calculator/lab_01_part_a.py
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
#
#!/usr/bin/env python3
# Calculator part a
# Christian Groves
# 11-1-17
Fahrenheit = int(input('Enter temperature in Fahrenheit: '))
Celcius = ((Fahrenheit - 32) / 1.8)
print(str(Celcius))
10 changes: 9 additions & 1 deletion Lab 01 - Calculator/lab_01_part_b.py
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
#
#!/usr/bin/env python3
# Calculator part a
# Christian Groves
# 11-1-17
print('Area of a trapezoid')
height = int(input('Enter the height of the trapezoid: '))
bottombase = int(input('Enter the length of the botom base: '))
topbase = int(input('Enter the length of the top base: '))
print('The area is: ' + str((1/2)*(bottombase + topbase) * height))
10 changes: 9 additions & 1 deletion Lab 01 - Calculator/lab_01_part_c.py
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
#
#!/usr/bin/env python3
# Calculator part a
# Christian Groves
# 11-1-17
import math
print('Area of a Square')
sidelen = int(input('Enter side lenght: '))
areasquare = sidelen ** 2
print('Area of the Square is: ' + str(areasquare))
50 changes: 49 additions & 1 deletion Lab 03 - Create a Quiz/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,49 @@
#
#!/user/bin/env python3
#Create a Quiz
#Christian Groves
#11-3-17
counter = 0
print('Pop Quiz')
answer1 = input('''What is the largest free to play game on PC: ''')
if answer1.lower() == 'warframe':
print('Correct')
counter += 1
else:
print('Incorrect')

answer2 = input('''When comes after 20013: ''')
if answer2 == '20014':
print('Correct')
counter += 1
else:
print('Incorrect')

answer3 = input('''What is the powerhouse of the cell: ''')
if answer3.lower() == 'mitochondria':
print('Correct')
counter += 1
else:
print('Incorrect')

answer4 = input('''What is the answer to the universe: ''')
if answer4 == '42':
print('Correct')
counter += 1
else:
print('Incorrect')

print('A. You')
print('B. Bill Gates')
print('C. Rick and Morty')
answer5 = input('''Who is dead: ''')

if answer5.lower() == 'b':
print('Correct')
counter += 1
else:
print('Incorrect')
if counter >= 4:
print("Congrats, you didn't fail")
print('Your score is ' + str(counter * 20) +'.0 percent.')
else:
print('Your score was terrible only a ' + str(counter * 20) + '.0 percent.')
84 changes: 83 additions & 1 deletion Lab 04 - Camel/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,83 @@
#
#!/usr/bin/env python3
#Camel
#Christian Groves
#11/9/17
import random
print('Welcome to Camel!')
print('You have stolen a camel to make your way across the great Mobi desert.')
print('The natives want their camel back and are chasing you down! Survive your')
print('desert trek and out run the natives.')
done = False
oasis = 0
miles = 0
thirst = 0
cameltired = 0
nativestravel = -20
cantinedrinks = 3
alive = True
while done is 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.')
userchoice = input('Your choice? ')
oasis = random.randrange(0, 20)
if userchoice.upper() == 'Q':
done = True
elif userchoice.upper() == 'D':
cameltired = 0
print('Your camel is happy.')
nativestravel += random.randrange(7, 14)
elif userchoice.upper() == 'E':
print('Miles traveled: '+ str(miles))
print('Drinks in canteen: ' + str(cantinedrinks))
print('The natives are '+ str(nativestravel) + ' miles behind you.')
elif userchoice.upper() == 'C':
randomint = random.randrange(10, 20)
miles += randomint
print('Miles traveled ' + str(randomint))
nativestravel += random.randrange(7, 14)
cameltired += random.randrange(1, 3)
thirst += 1
elif userchoice.upper() == 'B':
randomint = random.randrange(5, 12)
miles += randomint
print('Miles traveled ' + str(randomint))
nativestravel += random.randrange(7, 14)
cameltired += 1
thirst += 1
elif userchoice.upper() == 'A':
if cantinedrinks > 0:
cantinedrinks -= 1
thirst = 0
else:
print('Error')
if thirst > 4 and not thirst > 7 and done != True:
print('You are thirsty.')
elif thirst > 6 and done != True:
print('You died of thirst!')
done = True
alive = False
if cameltired > 5 and not cameltired > 9 and done != True:
print('Your camel is getting tired')
elif cameltired > 8 and done != True:
print('Your camel is dead.')
done = True
alive = False
if nativestravel > miles and done != True:
print('They have caught you')
alive = False
elif (nativestravel + 15) > miles and not nativestravel > miles:
print('The natives are getting close')
if oasis == 2:
print('You have found a oasis')
cantinedrinks = 3
cameltired = 0
thirst = 0
if miles >= 200:
if done != True:
print('You win')
done = True

53 changes: 52 additions & 1 deletion Lab 05 - Create a Picture/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,52 @@
#
#!/usr/bin/env python3
#Lab #5
#Christian Groves
#11/16/17
import pygame
pygame.init()
greenColor = 175
radius = 180
sunChange= (200,greenColor,40)
LIGHTBLUE=(126,213,242)
BLACK =(0,0,0)
WHITE =(255,255,255)
GREEN =(0,255,0)
RED =(255,0,0)
BLUE =(0,0,255)
PURPLE =(150,20,130)
size=(700,500)
xoff= 700
screen = pygame.display.set_mode(size)
pygame.display.set_caption("Christian's Cool Game")
done = False
clock = pygame.time.Clock()
font = pygame.font.Font(None, 25)
while done == False:
screen.fill(BLUE)
#green ground
pygame.draw.line(screen, GREEN , [0,400], [700,400],200)
#first cloud
pygame.draw.ellipse(screen, WHITE, [40, 20, 130, 90])
pygame.draw.ellipse(screen, WHITE, [70, 30, 140, 110])
pygame.draw.ellipse(screen, WHITE, [20, 40, 140, 110])
#second cloud
pygame.draw.ellipse(screen, WHITE, [440, 50, 140, 110])
pygame.draw.ellipse(screen, WHITE, [460, 20, 140, 110])
pygame.draw.ellipse(screen, WHITE, [480, 60, 140, 110])
for event in pygame.event.get():
if event.type == pygame.QUIT:
done=True

#House's
for xoff in range(700, 0, -200):
pygame.draw.rect(screen, PURPLE, [50+ xoff , 260, 100, 110])
pygame.draw.rect(screen, BLACK, [70+ xoff , 300, 30, 70])
pygame.draw.rect(screen, WHITE, [110+ xoff , 300, 30, 30])
pygame.draw.polygon(screen, RED, [[25+ xoff , 260], [175+ xoff, 260], [100+ xoff , 200]])


pygame.display.flip()

clock.tick(20)

pygame.quit ()
11 changes: 11 additions & 0 deletions Lab 06 - Loopy Lab/part_1.py
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
#!/usr/bin/env python3
#Lab #6
#Christian Groves
#11-15-17

#for loop to add
num = 10
for row in range(1,10):
for col in range(row,0,-1):
print(num,end=' ')
num += 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
#Lab #6
#Christian Groves
#11-15-17

#input for desired size
boxsize = int(input('Desired size: '))
horizontal = boxsize*2
spaces = (boxsize*2) -3
verticle = boxsize-1

#for loop to add the rows of o's
for row in range(1):
print('o'*horizontal)
#for loop to add the col
for col in range(1,verticle):
print('o',' '*spaces,end='o\n')
#for loop to add the rows at the end with o's
for row in range(1):
print('o'*horizontal)
24 changes: 23 additions & 1 deletion Lab 06 - Loopy Lab/part_3.py
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
#
#!/usr/bin/env python3
#Lab #6
#Christian Groves
#11-15-17
size = int(input('Size: '))


for row in range(1,10):
for digit1 in range(9 - row):
print(digit1, end=' ')
for spaces in range(1,row +1):
print(' ',end=' ')
for digit2 in range(row,0,-1):
print(digit2,end=' ')
print()
for botrow in range (9,0,-1):
for spacesbot in range(9- botrow, 0, -1):
print(' ',end=' ')
for digit3 in range(1, botrow+1):
print(digit3,end=' ')
for digit4 in range(botrow,0,-1):
print(digit4,end=' ')
print()
57 changes: 56 additions & 1 deletion Lab 06 - Loopy Lab/part_4.py
Original file line number Diff line number Diff line change
@@ -1 +1,56 @@
#
#!/usr/bin/env python3
#Lab 6 part 4
#Christian Groves
#11/21/17
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()

# -------- 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)
for x in range(0,700, 5):
for y in range(0,500,5):
pygame.draw.rect(screen, GREEN, [1 + x,1 + y ,2,2])
# --- Drawing code should go here

# --- Go ahead and update the screen with what we've drawn.
pygame.display.flip()

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

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