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
4 changes: 3 additions & 1 deletion Lab 01 - Calculator/lab_01_part_a.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#
cd#
temperature_Fahrenheit = int(input("enter temperature in fahrenheit: "))
print("the temperature in celsius is", (temperature_Fahrenheit-32)/1.8)
6 changes: 5 additions & 1 deletion Lab 01 - Calculator/lab_01_part_b.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
#

T_Height = int(input("enter the height of the trapezoid: "))
T_lengthbbase = int(input("Enter the length of the bottom base: "))
T_lengthtbase = int(input("Enter the length of the top base: "))
print("the area is: ",(T_lengthbbase + T_lengthtbase)*0.5*T_Height)
3 changes: 3 additions & 0 deletions Lab 01 - Calculator/lab_01_part_c.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
#
x = int(input("number1: "))
y = int(input("number2: "))
print(x+y)
42 changes: 42 additions & 0 deletions Lab 03 - Create a Quiz/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,43 @@
#!/usr/bin/env python3
#quiz
#jacob poncher
#11/3/17
#
correct_answers = 0
answer1 = int(input('what is 5+6? '))
if answer1 == 11:
print('correct')
correct_answers = correct_answers + 1
else:
print('incorrect')
print('what is 888 / 444? ')
print('a.1')
print('b.7')
print('c.3')
print('d.2')
answer2 = input('choice: ')
if answer2 == "d":
print("correct")
correct_answers = correct_answers + 1
else:
print('incorrect')
print('we are learning java right now')
answer3 = input('true or false: ')
if answer3 == "false":
print('correct')
correct_answers = correct_answers + 1
else:
print('incorrect')
answer4 = int(input("what is 2+11? "))
if answer4 == 13:
print('correct')
correct_answers = correct_answers + 1
else:
print('incorrect')
answer5 = int(input('what is 20/5? '))
if answer5 == 4:
print('correct')
correct_answers = correct_answers + 1
else:
print('incorrect')
print('you got',correct_answers*20,"%")
81 changes: 80 additions & 1 deletion Lab 04 - Camel/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,80 @@
#
#!/usr/bin/env python3
# camel
#jacob poncher
# 11/8/17

""" Camel Game """

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!')
print('Survive your desert trek and out run the natives')
miles_traveled = 0
thirst = 0
camel_tiredness =0
natives_distance =-20
drinks = 5
done = False
while not done:
print()
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('choice: ')
print()
if choice == "q":
done = True
elif choice == "e":
print()
print("miles traveled: ",miles_traveled)
print("drinks in canteen: ", drinks)
print('the natives are',abs(natives_distance),"miles behind you.")
print()
elif choice == 'd':
camel_tiredness = 0
print('the camel is happy')
natives_distance = natives_distance + random.randrange(7,14)
elif choice == "c":
miles_traveled = miles_traveled + random.randrange(10,21)
print('miles traveled:',miles_traveled)
thirst = thirst + 1
camel_tiredness = camel_tiredness + random.randrange(1,4)
natives_distance = natives_distance + random.randrange(7,14)
elif choice == "b":
miles_traveled = miles_traveled + random.randrange(5,12)
print('miles traveled',miles_traveled)
thirst = thirst + 1
camel_tiredness = camel_tiredness + 1
natives_distance = natives_distance + random.randrange(7,14)
elif choice == "a":
if drinks > 0:
drinks = drinks - 1
else:
print('error')
else:
print("That is not a valid choice! ")


if thirst > 4 and thirst < 6:
print('you are thirsty')
if thirst > 6:
print('you died of thirst')
done = True

if natives_distance >= 0:
print('the natives have caught up')
done = True
elif natives_distance >= -15:
print('The natives are getting close')

if miles_traveled >= 200 and done == False:
print('you win the game')
miles_travled = 0
thirst = 0
camel_tiredness = 0
drinks = 5
natives_distance = -20
17 changes: 17 additions & 0 deletions Lab 06 - Loopy Lab/part_1.py
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
# !/usr/bin/env/ python3
#part 1
#jacob poncher
#11/15/17

# start a variable at 10
x = 10

#create a loop to do 9 rows
for i in range(1,10):
#create a loop to print digits
for j in range(i):
#print the variable
print(x, end=' ')
#increment the variable
x= x+1
#print a new line
print()
13 changes: 12 additions & 1 deletion Lab 06 - Loopy Lab/part_2.py
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
#
#!/usr/bin/env/ python3
#part 1
#jacob poncher
#11/15/17
# input statement for number
number = int(input('number: '))
# print o times 2 for the input
print('o'* (number*2 + 2 ))
# loop to print 2 times the number of o
for i in range(number - 2):
print('o' + ' '*(number*2) + 'o')
print('o'* (number*2 + 2))
70 changes: 69 additions & 1 deletion Lab 06 - Loopy Lab/part_4.py
Original file line number Diff line number Diff line change
@@ -1 +1,69 @@
#
"""
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()

# -------- 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 y in range(0,500,10):
for x in range(0,700,10):
pygame.draw.rect(screen, GREEN ,[x, y, 5, 5], 0)

print()



# --- 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()
69 changes: 68 additions & 1 deletion Lab 07 - Adventure/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,68 @@
#
#!/usr/bin/env
# main_program.py
# jacob poncher
# 11/20/17

''' first draft of a text adventure game '''

room_list = []
room = [ "you are in the entrance.there is a passage south to the rest of the house ",None, None, 3, None]
room_list.append(room)
room = ["you are in the office, go west to the front hall ",None,None,None,10]
room_list.append(room)
room = [ " you are in the kitchen,go east to the front hall ", None,3 ,None,None]
room_list.append(room)
room = [ " you are in the west front hall,kitchen is to the west,living room is south ,and office is to the east,entrance is north", 0 ,10, 4, 2]
room_list.append(room)
room = [ " You are in the living room,go north to the front hall ",3 ,None ,None ,None]
room_list.append(room)
room = ["you are in the bedroom,the back hall is to the east",None,8,None,None]
room_list.append(room)
room = [ " you are in the bedroom, go west to the center hall",None,None,None,9]
room_list.append(room)
room = ["you are in the bathroom,the back hall is to the west" ,None,None,None,8]
room_list.append(room)
room = [ "you are in the back hall,bedroom is to the west ,center hall is north ,and bathroom is to the east", 9 , 7 ,None,5]
room_list.append(room)
room = [" you are in the center hall,north is the east front hall ,south is the back hall and the bedroom is east " , 10, 6, 8, None]
room_list.append(room)
room = [" you are in the east front hall, office is to the east,center hall is south,west front hall is west",None,1,9,3]
room_list.append(room)

current_room = 0
done = False
while done == False:
print(room_list[current_room][0])
print()
next_room = current_room
user_choice = input("what do you want to do: ")
if user_choice == "south":
next_room = room_list[current_room][3]
if next_room == None:
print('you cant go that way')
else:
current_room = next_room

if user_choice == "north":
next_room = room_list[current_room][1]
if next_room == None:
print('you cant go that way')
else:
current_room = next_room

if user_choice == "east":
next_room = room_list[current_room][2]
if next_room == None:
print('you cant go that way')
else:
current_room = next_room

if user_choice == "west":
next_room = room_list[current_room][4]
if next_room == None:
print('you cant go that way')
else:
current_room = next_room

if user_choice == "quit":
done = True
Loading