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
18 changes: 18 additions & 0 deletions Lab 01 - Calculator/lab_01_part_a.py
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
#
#!/usr/bin/env.python3
#Converting Fahrenheit to Celsius
#Jake Faucett
#11-7-17





tempF = int(input('Enter temperature in Fahrenheit: '))

#Converting Fahrenhiet to Celcuis

tempC = (tempF - 32) * (5/9)

#Print this to the console

print('The temperature in Celcuis: ', tempC)
16 changes: 16 additions & 0 deletions Lab 01 - Calculator/lab_01_part_b.py
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
#

#!/usr/bin/env.python3
#Converting Fahrenheit to Celsius
#Jake Faucett
#11-7-17

#Find the Area of a Trapezoid

height = int(input('Enter the height of the trapezoid: '))
lengthB = int(input('Enter the length of the bottom base: '))
lengthT = int(input('Enter the length of the top base: '))

#Calculate the area
Area = 0.5 * (lengthB + lengthT) * height

print ('The area is: ', Area)
14 changes: 14 additions & 0 deletions Lab 01 - Calculator/lab_01_part_c.py
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
#
#!/usr/bin/env.python3
#Converting Fahrenheit to Celsius
#Jake Faucett
#11-7-17

#Solving the area of a circle

r = int(input('Enter the radius of the circle: '))

#Calculate the Area

Area =int(3.14 * r ** 2)

print('The area of the circle: ', Area)
10 changes: 9 additions & 1 deletion Lab 03 - Create a Quiz/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
#
#!/user/bin/env python3
#chap6.py
#Jake Faucett
#11/13/17

print('Quiz Time!')

input('What side of my head do I have a implant on? ')
if "Left"
11 changes: 11 additions & 0 deletions Lab 06 - Loopy Lab/chap6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/user/bin/env python3
#chap6.py
#Jake Faucett
#11/13/17

x = 0
for i in range(10):
x += 1
for j in range(10):
x += 1
print(x)
16 changes: 16 additions & 0 deletions Lab 06 - Loopy Lab/part_1.py
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
#!/user/bin/env python3
#loopy lab
#Jake Faucett
#11/16/17

#Start at 10 for the triangle
begin = 10
#Do this 9 times
for row in range(9):
# Loop to print the digits
for j in range(row +1):
#prints the variable
print(begin, end= ' ')
#Adds 1 to start so the line is higher
begin += 1
#Prints a new line
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 @@
#
#!/user/bin/env python3
#loopy lab
#Jake Faucett
#11/16/17
n= int(input('E.g. n = '))

#Variable for spaces
spaces = (n*2) - 2

#print the o times the variable and times 2
print('o' * ((n)*2))

#loop variable -1
for i in range(1, n-1):

#print the o's + spaces times and then place another o
print('o' + (' '*spaces) + 'o')

#print the final row of o's times the varaible and 2
print('o'*(n)*2)
68 changes: 68 additions & 0 deletions Lab 06 - Loopy Lab/part_4.py
Original file line number Diff line number Diff line change
@@ -1 +1,69 @@
#
#!/user/bin/env python3
#loopy lab
#Jake Faucett
#11/16/17

"""
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)
GREEN = (0, 255, 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()
49 changes: 30 additions & 19 deletions Worksheets/worksheet_01.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,23 @@
and punctuation. Please limit the length of each line to 80 characters.

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

2. How do you enter a comment in a program?

print('Jake Faucett')
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?

Answer:(2 / 3) = 0.66 (2 // 3)= 0
print(2 / 3)
print(2 // 3)

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

The reason they are different is because floor division rounds it while regular division doesn't
4. Write a line of code that creates a variable called pi and sets it to an appropriate value.
pi = 3
5. Why does this code not work?

It wouldn't work because the first a is capitalized
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?
the better variable name to use? area_of_rectangle

a
A
Expand Down Expand Up @@ -60,86 +58,99 @@
x2x
total%
#left

Answer: account number because you cannot have spaces
8. Why does this code not work?

print(a)
a = 45

Answer: Because the print statement needs to be after the variable got set to a value.
9. Explain the mistake in this code:

pi = float(3.14)

10. This program runs, but the code still could be better. Explain what is
wrong with the code.
Answer: the 3.14 is unnecessary since it already is a float.
10. This program runs, but the code still could be better. Explain what is wrong with the code.

radius = float(input("Radius:"))
x = 3.14
pi = x
area = pi * radius ** 2
print(area)

Answer: you could get rid of the variable x entirely.
11. Explain the mistake in the following code:

x = 4
y = 5
a = ((x) * (y))
print(a)

Answer: There is multiple statements found while compiling a single statement.
12. Explain the mistake in the following code:

x = 4
y = 5
a = 3(x + y)
print(a)

Answer: There is multiple statements found while compiling a single statement.
13. Explain the mistake in the following code:

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

Answer: They called for radius to be printed
14. Do all these print the same value? Which one is better to use and why?

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

Answer: Yes they print the same value. The second one is the best because you don't want too many spaces but you do want some so it is not so clustered.
15. What is a constant?

A variable that stays the same.
16. How are variable names for constants different than other variable names?

Answer: A constant stays the same but a constant 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.)

Answer: print('""'/n)
19. Can a Python program print text to the screen using single quotes instead
of double quotes?

Answer: Yes
20. Why does this code not calculate the average?

print(3 + 4 + 5 / 3)


Answer: It does division first because of order of operations
21. What is an ``operator'' in Python?

Answer:An operator is a character that represents an action,
22. What does the following program print out?

x = 3
x + 1
print(x)


Answer: 3
23. Correct the following code:

user_name = input("Enter your name: )"



+ Answer:username =input('Enter you name: ')
+ print(username)
24. Correct the following code:

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


Answer:int(input("Enter your age: "))


32 changes: 16 additions & 16 deletions Worksheets/worksheet_02.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,37 @@
1. Give an example of a binary number. (While a number such as ``1'' can be a
binary, decimal, and hexadecimal number, try coming up with an example that
better illustrates the differences between the different bases of numbers.)

Answer:100101
2. Give an example of a decimal number.

Answer:0.238
3. Give an example of a hexadecimal number.

Answer:A37E
4. Convert the numbers 1, 10, 100, 1000, and 10000 from binary to decimal.

Answer:1, 2, 4, 8, 16
5. What is a compiler?

Answer: A special program that processes statements written in a particular programming language and turns them into machine language
6. What is source code?

Answer: a text listing of commands to be compiled or assembled into an executable computer program.
7. What is machine language? (Don't just say binary. That's not correct.)

Answer:The coding
8. What is a first generation language? (Don't just say binary. That's not correct.)

Answer: the level of instructions and data that the processor is actually given to work on
9. What is a second generation language?

Answer:An assembler converts the assembler language statements into machine language.
10. What is a third generation language? (Explain, don't just give one example.)

Answer:It's a complete program code
11. What is an interpreter and how does it differ from a compiler?

Answer:a program that can analyze and execute a program line by line.
12. Search the web and find some of the most popular programming languages.
List the website(s) you got the information from and what the languages are.

Answer:Java, Python, C https://www.inc.com/larry-kim/10-most-popular-programming-languages-today.html
13. Look at the job boards and see what languages people are looking for.
List the languages and the job board you looked at.

Answer:Java
14. What is the difference between the ``syntax'' and ``semantics'' of a
language?

language? Syntax is a word error while semantics is invloving symbols
Answer:
15. Pick a piece of technology, other than a computer you use regularly. Briefly
describe the hardware and software that run on it.

Answer:Samsung S7 edge phone, Android 6.0.1 Marshmallow

Loading