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
11 changes: 10 additions & 1 deletion Lab 01 - Calculator/lab_01_part_a.py
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
#
#!/usr/bin/env python
# 1.1 Part A
# Asia Robinson
# 11/2/2017

Fahrenheit = int(input("Enter a temperature in Fahrenheit: "))

Celsius = (Fahrenheit - 32) * 5.0/9.0

print("The Temperature in Celsius: ", Celsius)
14 changes: 13 additions & 1 deletion Lab 01 - Calculator/lab_01_part_b.py
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
#
#!/usr/bin/env python
# 1.2 Part B
# Asia Robinson
# 11/2/2017

print("Area of a trapezoid")
trapazoid_height_int = int(input("Enter the height of the trapezoid: "))
trapazoid_length_bottom_int = int(input("Enter the length of the bottom base: "))
trapazoid_length_top_int = int(input("Enter the length of the top base: "))

trapazoid_area_int = ( .5 * (trapazoid_length_bottom_int + trapazoid_length_top_int) * trapazoid_height_int)

print('The area is:', trapazoid_area_int)
12 changes: 11 additions & 1 deletion Lab 01 - Calculator/lab_01_part_c.py
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
#
#!/usr/bin/env python
# 1.3 Part C
# Asia Robinson
# 11/2/2017

Celsius = int(input("Enter a temperature in Celsius: "))

Fahrenheit = (9.0/5.0 * Celsius + 32)

print("The Temperature in Fahrenheit: ", Fahrenheit)

71 changes: 70 additions & 1 deletion Lab 03 - Create a Quiz/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,70 @@
#
#!/usr/bin/env python
# 3.1 Create a Quiz
# Asia Robinson
# 11/2/2017

print("Quiz Time!")
print()
quiz1 = input("1. What is 61,090 - 59,352 ? ")
correct = 0
incorrect = 0

if quiz1 == ("1738"):
print("Ayee You're Right!")
correct = correct + 1
else:
print("Incorrect")
incorrect = correct - 1
print()
quiz2 = input("2. What is Fetty Wap government first name? ")
if quiz2 == ("willie"):
print("Ayee You're Right!")
correct = correct + 1
else:
print("Incorrect")
incorrect = correct - 1
print()
quiz3 = ("3. What is Asia favorite color?")
print(quiz3)
print("a. Red")
print("b. Blue")
print("c. Green")
answer = input("Your choice: ")
if answer == "b":
print("Ayee You're Right!")
correct = correct + 1
else:
print ("Incorrect")
incorrect = correct - 1
print()
quiz4 = ("4. Why is a bad joke like a bad pencil?")
print(quiz4)
print("a. because it has no point")
print("b. because it's not sharp")
answer = input("Your choice: ")
if answer == "a":
print("Ayee You're Right!")
correct = correct + 1
else:
print ("Incorrect")
incorrect = correct - 1
print()
quiz5 = ("5. Mary's father has 5 daughters. Nana, Nene, NiNi, and NoNo. Who's the 5th daughter ?")
print(quiz5)
print("a. Nicki")
print("b. NuNu")
print("c. Mary")
answer = input("Your choice: ")
if answer == "c":
print("Ayee You're Right!")
correct = correct + 1
else:
print ("Incorrect")
incorrect = correct - 1
print()
print ("Total score: " + str(correct) + "/5")
division = float(100)/float(5)
multiply = float(division*correct)
result = round(multiply)
print ("Total percentage is", int(result), "%")

85 changes: 84 additions & 1 deletion Lab 04 - Camel/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,84 @@
#
#!/usr/bin/env python
# 4.2 Sample Run of Camel
# Asia Robinson
# 11/6/2017

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 desert trek and out run the natives.')
print()
user_distance = 0
camel = 0
drinks = 3
thirst = 0
natives = -20
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()
if random.randint(1,20) == 5:
drinks = 3
camel = 0
print('You found an oasis!')
if (user_distance - natives) < 15:
print('The natives are getting close')
if natives >= user_distance:
print('The natives caught you and took you back to their village')
done = True
if camel >= 8:
print('Your camel is dead')
done = True
elif camel > 5:
print('Your camel is tired')
if thirst >= 6:
print('You died!')
done = True
elif thirst > 4:
print('You are thirsty!')

if choice == 'Q':
done = True

elif choice == 'E':
print('Miles traveled: ' + str(user_distance))
print('Drinks in canteen: ' + str(drinks))
print('The natives are ' + str(abs(user_distance-natives)) + ' miles behind you.')

elif choice == 'D':
camel = 0
print('The camel is happy')
natives = random.randint(7,14) + natives

elif choice == 'C':
r = random.randint(10,20)
user_distance = r + user_distance
print('You traveled ' + str(r) + ' miles!')
thirst = thirst + 1
camel = random.randint(1,3)
n = random.randint(7,14)
natives = n + natives
print('The natives have moved ' + str(n) + ' miles!')

elif choice == 'B':
R = random.randint(5, 12)
Ran = random.randint(7,14)
user_distance = user_distance + R
print('You have traveled ' + str(R) + ' miles!')
thirst = thirst + 1
camel = camel + 1
natives = natives + Ran
print('The natives have moved ' + str(Ran) + ' miles!')

elif choice == 'A':
if drinks > 0:
drinks = drinks - 1
thirst = 0
else:
print('You cannot drink from an empty canteen')

42 changes: 42 additions & 0 deletions Lab 06 - Back to Looping.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
'''
for i in range(10):
print("", end = "* ")
print()
for i in range(5):
print("", end = "* ")
print()
for i in range(20):
print("", end = "* ")


for i in range(10):
for row in range(10):
print("*", end = " ")
print()

for i in range(10):
for j in range(i+1):
print(j, end = " ")
print()

for i in range(10):
for space in range(i):
print(" ",end= " ")
for digit in range(10-i):
print(digit,end= " ")
print()

for i in range(1, 10):
for digit in range(1, 10):
print(digit * i, end = " ")
print()
'''

for i in range(10):
for j in range(10-i):
print (" ",end=" ")
for j in range(1,i+1):
print (j,end=" ")
for j in range(i-1,0,-1):
print (j,end=" ")
print()
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 python
# 6.2 Part 1
# Asia Robinson
# 11/16/2017

startnumber = 10

for row in range(1,10):
for col in range(row):
print(startnumber,end=" ")
startnumber += 1
print()
11 changes: 10 additions & 1 deletion Lab 06 - Loopy Lab/part_2.py
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
#
#!/usr/bin/env python
# 6.2 Part 2
# Asia Robinson
# 11/15/2017

number = int(input("enter number of o: "))
for row in range(number):
for column in range(2*number):
print('o' if row in(0,number-1) or column in(0,(2*number)-1) else ' ', end=' ')
print()
58 changes: 57 additions & 1 deletion Lab 06 - Loopy Lab/part_4.py
Original file line number Diff line number Diff line change
@@ -1 +1,57 @@
#
#!/usr/bin/env python
# 6.2 Part 4
# Asia Robinson
# 11/16/2017

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(WHITE)

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