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
#Converting Fahrenhiet to Celsius
#Evan Witterholt
#11/2/2017
temperature = int(input("Enter temperature in Fahrenheit: "))
convert1 = temperature - 32
print(fahrenheit * .5556)
11 changes: 10 additions & 1 deletion Lab 01 - Calculator/lab_01_part_b.py
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
#
#!/usr/bin/env python3
# Finding the area of a trapezoid
# Evan Witterholt
#11/2/2017
height = int(input("Enter the height of the trapezoid: "))
length = int(input("Enter the length of the bottom base: "))
length2= int(input("Enter the length of the top base : "))
part1 = length + length2
part2 = height * part1 * 0.5
print(part2)
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
#Finding the area of a circle
#Evan Witterholt
#11/2/2017
radius = int(input("Enter Radius of the Circle: "))
pi = 3.14
part1 = radius**2
part2 = pi * part1
print(part2)
8 changes: 8 additions & 0 deletions Lab 02 - Computer History/Chapter 2 report on video.docx
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
Report goes here
Evan Witterholt
12/7/17

The computer industry has changed a lot since the creation of this video and the creation of the GUI. Everything used to be
completly text based, but now things are even easier than when the GUI was created. Many things have changed since Windows 95.
We have quicker and easier method to access or save files,transfer documents, and to do just about anything else on our computers.
This video showed that no matter what technology you have, people will always try to innovate and upgrade what they are given.

34 changes: 33 additions & 1 deletion Lab 03 - Create a Quiz/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
#
#!/usr/bin/env python3
#Create a Quiz
#Evan Witterholt
#11/6/17

score = 0

question1 = int(input('How many states are in the US?: '))
if question1 == 50:
score += 1
print('That is correct!')

question2 = int(input('Pluto is a planet. 1 for True or 2 for False?: '))
if question2 == 2:
score += 1
print('That is correct!')

question3 = int(input('What is 9+10?: '))
if question3 == 19:
score += 1
print('That is correct!')

question4 = int(input('How many planets are between the Earth and the Moon?: '))
if question4 == 0:
score += 1
print('That is correct!')

question5 = int(input('What question are you on?: '))
if question5 == 5:
score += 1
print('That is correct!')

print (score, 'out of 5')
98 changes: 97 additions & 1 deletion Lab 04 - Camel/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,97 @@
#
#!/usr/bin/env python3
# Camel Game
# Evan Witterholt
# 11/11/17


import random

miles = 0
hunger = 0
cowboys = -20
thirst = 0
horsetiredness = 0

print('Welcome to Stealy Horsey!')
print('You have stolen the Krabby Patty Secret Formula and kidnapped a horse to make your way across the Wild West.')
print('The cowboys want their horse back and are chasing you down! Survive your')
print('western trek and outrun the cowboys.')


done = False
while done == False:


townlocation = random.randint(1,21)
cowboyslocation = random.randint(7,15)
milesgone = random.randint(10,21)
milesbehind = miles - cowboys



print('A. Drink from canteen.')
print('B. Continue at moderate speed.')
print('C. Continue at full speed.')
print('D. Stop for the night.')
print('E. Status check.')
print('Q. Quit.')

userchoice = input('Your choice: ')

if userchoice.upper() == 'Q':
done = True

elif userchoice.upper() == 'E':
print('\nMiles traveled:' , str(miles),'\nHunger:' ,str(hunger), '\nThirst:' ,(thirst), '\nHorse Tiredness:',str(horsetiredness),'\nMiles Cowboys have traveled:',str(cowboys),'miles.\n')

elif userchoice.upper() == 'D':
print('\nYou found more food and water.\n''The horse is well rested.' + '\nCowboys are',str(milesbehind), 'miles behind.\n')
cowboys += cowboyslocation
horsetiredness -= horsetiredness
hunger -= hunger
thirst -= thirst




elif userchoice.upper() == 'C':
miles = miles + random.randint(15, 23)
print('\nYou traveled:',str(milesgone), 'miles\n', '\nCowboys are',str(milesbehind), 'miles behind.\n' )
hunger += 1
cowboys += cowboyslocation
horsetiredness += 4

elif userchoice.upper() == 'B':
miles = miles + random.randint(5,13)
print('\nYou traveled:', str(milesgone), 'miles\n','Cowboys have traveled', str(cowboyslocation),'miles.\n')
hunger += 1
cowboys += cowboyslocation
horsetiredness += 2

elif userchoice.upper() == 'A':
thirst -=3
cowboys += cowboyslocation
print('You stopped to drink water.\nThe Cowboys traveled', str(cowboyslocation), 'miles.\n')

if horsetiredness < 9 and horsetiredness > 6:
print('The horse needs rest now.\n')

elif horsetiredness > 10:
print('The horse died.')
done = True

elif miles <= cowboys:
print('You have been killed.')
done = True

elif miles >= 200:
print('You escaped!')
done = True

elif hunger <= -5:
print('You starved to death.')
done = True

elif thirst <= -5:
print('You died of dehydration.')
doen = True
38 changes: 37 additions & 1 deletion Lab 05 - Create a Picture/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,37 @@
#
#!/usr/bin/env python3
# Drawing a picture in python
# Evan Witterholt
# 11/11/17

import pygame

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)

done = False

clock = pygame.time.Clock()

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

screen.fill(GREEN)

pygame.draw.rect(screen,BLACK,[-25,35,750,150],2)

pygame.display.flip()

clock.tick(60)


pygame.quit()



66 changes: 44 additions & 22 deletions Worksheets/worksheet_01.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,28 @@
and punctuation. Please limit the length of each line to 80 characters.

1. Write a line of code that will print your name.

print("Evan Witterholt")
2. How do you enter a comment in a program?

#
3. What do the following lines of code output?
ALSO: Why do they give a different answer?

print(2 / 3)
print(2 // 3)
/ is division, // is floor division
print(2 / 3) = 0.6666666666
print(2 // 3) = 0

4. Write a line of code that creates a variable called pi and sets
it to an appropriate value.
pi = 9

5. Why does this code not work?

A and a are two different variables
A = 22
print(a)

6. All of the variable names below can be used. But which ONE of these is
the better variable name to use?


area_of_rectangle
a
A
Area
Expand All @@ -43,7 +45,7 @@
APPLE
Apple2
1Apple
account number
account number this one
account_number
account.number
accountNumber
Expand All @@ -58,20 +60,21 @@
great.big.variable
2x
x2x
total%
#left
total% this one
#left this one

8. Why does this code not work?
8. Why does this code not work? The print statement needs to be last

print(a)
a = 45

9. Explain the mistake in this code:

Only the first 3 digits are printing
pi = float(3.14)

10. This program runs, but the code still could be better. Explain what is
wrong with the code.
You do not need x =3.14

radius = float(input("Radius:"))
x = 3.14
Expand All @@ -80,51 +83,62 @@
print(area)

11. Explain the mistake in the following code:

There are excess parenthesis
x = 4
y = 5
a = ((x) * (y))
print(a)

12. Explain the mistake in the following code:

There is no int. All the numbers are being typed as strings.
x = 4
y = 5
a = 3(x + y)
print(a)

13. Explain the mistake in the following code:
A radius does not need a float command

radius = input(float("Enter the radius:"))

14. Do all these print the same value? Which one is better to use and why?

Yes, the first one

print(2/3+4)
print(2 / 3 + 4)
print( 2 / 3+ 4 )

15. What is a constant?

A constant is a variable that, if changed, will result in an error.

16. How are variable names for constants different than other variable names?

A constant stays the same but a variable will be able to change.
"" ""

17. What is a single quote and what is a double quote?
Give and label an example of both.
'my name'
"my name"


18. Write a Python program that will use escape codes to print a double-quote
and a new line using the Window's standard. (Note: I'm asking for the Window's
standard here. Look it up out of Chapter 1.)
print("" ""/n)

19. Can a Python program print text to the screen using single quotes instead
of double quotes?
of double quotes? Yes

20. Why does this code not calculate the average?

Order of Operations calls for division to be done before addition
print(3 + 4 + 5 / 3)


21. What is an ``operator'' in Python?

Operators carry out arithmetic or logical computation (+, -, >, etc.)

22. What does the following program print out?
It prints 3. x+1 does not print.

x = 3
x + 1
Expand All @@ -133,12 +147,20 @@

23. Correct the following code:

user_name = input("Enter your name: )"
user_name = input("Enter your name: ")


24. Correct the following code:

value = int(input(print("Enter your age")))
value = int(input("Enter your age: "))











Expand Down
Loading