Skip to content
Open
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 Celcius
+#Jordan Watt
+#11-2-17
+
+"""Converting Fahrenheit to Celcuis"""
+
+#Letting the User Define the Temperature
+
+tempF = int(input('Enter temperature in Fahrenheit: '))
+
+#Using the conversion forumula for Fahrenheit to Celcuis
+
+tempC = (tempF - 32) * (5/9)
+
+#print to console
+
+print('The temperature in Celsius: ', tempC)
25 changes: 25 additions & 0 deletions Lab 01 - Calculator/lab_01_part_b.py
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
#
#!/usr/bin/env python3
+#Trapezoid Area
+#Jordan Watt
+#11-2-17
+
+"""Using the Height and length of the top & bottom base of the Trapezoid we can find the area"""
+
+#Title
+
+print('Area of a trapezoid')
+
+#define height, and length of Top & Bottom
+
+height = int(input('Enter the height of the trapezoid: '))
+botLength = int(input('Enter the length of the bottom base: '))
+topLength = int(input('Enter the length of the top base: '))
+
+#Formula
+
+area = .5*(topLength + botLength)*height
+
+#print
+
+print('The area is:',area)
View
22 changes: 22 additions & 0 deletions Lab 01 - Calculator/lab_01_part_c.py
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
#
#!/usr/bin/env python3
+#Circle Area
+#Jordan Watt
+#11-2-17
+
+"""Using the radius to find the Area of a circle"""
+
+#import math
+
+from math import pi
+
+#user input for radius
+
+radius = int(input('Enter the radius: '))
+
+#Equation
+
+area = pi*radius**2
+
+#print
+
+print('The area is:', area)
65 changes: 65 additions & 0 deletions Lab 03 - Create a Quiz/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,66 @@
#
#!/usr/bin/env python3
+#Quizz
+#Jordan Watt
+#11-3-17
+
+"""Create a quiz that is 5 questions long"""
+
+#Accumulator for points
+
+total = 0
+
+#Question 1 [numbers]
+
+qOne = int(input('How many bits are in a byte? '))
+if qOne == 8:
+ total += 1
+ print('Correct!')
+else:
+ print('EERRNNGGG!!!')
+print('')
+
+#Question 2 [selection]
+
+qTwo = input('What is the name of Master Cheifs home planet?\nD-"Eridanus II"\n')
+if qTwo.lower() == 'c':
+ total += 1
+ print('Correct!')
+else:
+ print('EERRNNGGG!!!')
+print('')
+
+#Question 3 [text]
+
+qThree = input('What is the name of the national anthem? ')
+if qThree.lower() == 'the star spangled banner':
+ total += 1
+ print('Correct!')
+else:
+ print('EERRNNGGG!!!')
+print('')
+
+#Question 4 [number]
+
+qFour = int(input('"Sally sold seashells by the seashore,\nIf Sally sold seashells by the seashore,\nHow many seashells did sally sell?",\nHow many words start with s? '))
+if qFour == 11:
+ total += 1
+ print('Correct!')
+else:
+ print('EERRNNGGG!!!')
+print('')
+
+#Question 5 [text]
+
+qFive = input('What is the name of the "Gray Wizard",\nin the Lord of the Rings? ')
+if qFive.lower() == 'gandalf':
+ total += 1
+ print('Correct!')
+else:
+ print('EERRNNGGG!!!')
+print('')
+
+#Calculating Percentage
+
+perc = (total / 5) * 100
+print(str(perc) + '%')
120 changes: 120 additions & 0 deletions Lab 04 - Camel/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,121 @@
#
#!/usr/bin/env python3
+#Space Smuggler
+#Jordan Watt
+#11-6-17
+
+"""You stolen a camel and must fight, nature and man to survive!"""
+
+#Imports
+
+import random
+
+#Accumulators
+
+miles = 0
+hunger = 0
+fuel = 6
+Empire = -20
+rations = 4
+
+#Introduction
+
+print('\nWelcome to Space Smuggler!\n\nYou have stolen a space ship to make your way across the Outer Rim.\nThe Empire want their space ship back and are chasing you down!\nSurvive your space trek and out run NASA.\n')
+
+#While choices
+
+done = False
+while done == False: #Choices
+
+ #most-recent
+
+ oasis = random.randint(1, 21)
+ nasatra = random.randint(7, 15)
+ milestra = random.randint(10, 21)
+
+ print('A. Open a bag of rations.\nB. Ahead moderate speed.\nC. Ahead full speed.\nD. Stop for the night.\nE. Status check.\nQ. Quit.')
+ user_choice = input('Your choice? ')
#Quits Game
+
+ if user_choice.upper() == 'Q':
+ done = True
+
+ #Check Status
+
+ elif user_choice.upper() == 'E':
+ print('\nMiles traveled: ' + str(miles) + '\nRations left:' + str(rations) + '\nNASA is', str(nasa * -1), 'miles behind you.')
+
+ #Stop for the night
+
+ elif user_choice.upper() == 'D':
+ fuel = 3
+ print('\nYou found more fuel!')
+ Empire = Empire - (milestra - nasatra)
+
+ #Full Speed
+
+ elif user_choice.upper() == 'C':
+ miles = miles + milestra
+ print('\nYou traveled:', str(milestra), 'miles\n')
+ hunger += 1
+ fuel = fuel - random.randint(1, 4)
+ Empire = Empire - (milestra - nasatra)
+
+ #Moderate Speed
+
+ elif user_choice.upper() == 'B':
+ miles = miles + random.randint(5, 13)
+ print('\nYou traveled:', str(milestra), 'miles\n')
+ hunger += 1
+ fuel -= 1
+ Empire = Empire - (milestra - nasatra)
+
+ #Eat Rations
+
+ elif user_choice.upper() == 'A':
+ if rations != 0:
+ rations -= 1
+ hunger = 0
+ else:
+ print('No rations left!\n')
+
+ #Conditons:
+ #Hunger
+
+ if hunger >= 4:
+ print('You are hungry!\n')
+ if hunger > 6:
+ print('You died of starvation!\n')
+ done = True
+
+ #Fuel
+
+ if -3 < fuel <= 0:
+ print('Your running on fumes!\n')
+ if -3 >= fuel:
+ print('Your ship ran out of gas\nThe Empire caught you :(\n')
+ done = True
+ continue
+
+ #NASA
+
+ if Empire >= 0:
+ print('The Empire has caught you!\n')
+ done = True
+ continue
+ elif 0 > Empire >= -15:
+ print('The Empire is gaining on you!\n')
+
+ #Winning
+
+ if miles >= 200:
+ print('YOU MADE IT ACROSS THE OUTER RIM!!!\n')
+
+ #Oasis
+
+ oasis = random.randint(1, 21)
+ if oasis == 2:
+ print('You found the Rebel Alliance!\n')
+ hunger = 0
+ fuel = 3
+ rations = 4
107 changes: 106 additions & 1 deletion Lab 05 - Create a Picture/main_program.py
Original file line number Diff line number Diff line change
@@ -1 +1,106 @@
#
#!/usr/bin/env python 3
#Destroy The City PyGame
#Jordan Watt
#11-9-17
>>>>>>> d65a200f26d213f86446b9aa3fa7733773ae286a

import pygame

WHITE = (255, 255, 255)
GREEN = (144, 212, 178)
PINK = (209, 21, 184)
BLUE = (75, 51, 232)
YELLOW = (226, 232, 51)
BLACK = (0, 0, 0)
BROWN = (87, 59, 23)
PI = 3.141592653

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("Destroy The City")

# 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

# If you want a background image, replace this clear with blit'ing the
# background image.
screen.fill(BLACK)

# Draw a rectangle
pygame.draw.rect(screen, BLUE, [120, 150, 100, 200])
pygame.draw.rect(screen, BLUE, [470, 150, 100, 200])
pygame.draw.rect(screen, GREEN, [580, 150, 100, 200])
pygame.draw.rect(screen, GREEN, [10, 150, 100, 200])
# The top row of 'windows' on the buildings
pygame.draw.rect(screen, YELLOW, [20, 170, 30, 20])
pygame.draw.rect(screen, YELLOW, [70, 170, 30, 20])
pygame.draw.rect(screen, YELLOW, [130, 170, 30, 20])
pygame.draw.rect(screen, YELLOW, [180, 170, 30, 20])
pygame.draw.rect(screen, YELLOW, [480, 170, 30, 20])
pygame.draw.rect(screen, YELLOW, [530, 170, 30, 20])
pygame.draw.rect(screen, YELLOW, [590, 170, 30, 20])
pygame.draw.rect(screen, YELLOW, [640, 170, 30, 20])
# The middle row of 'windows' on the buildings
pygame.draw.rect(screen, YELLOW, [20, 220, 30, 20])
pygame.draw.rect(screen, YELLOW, [70, 220, 30, 20])
pygame.draw.rect(screen, YELLOW, [130, 220, 30, 20])
pygame.draw.rect(screen, YELLOW, [180, 220, 30, 20])
pygame.draw.rect(screen, YELLOW, [480, 220, 30, 20])
pygame.draw.rect(screen, YELLOW, [530, 220, 30, 20])
pygame.draw.rect(screen, YELLOW, [590, 220, 30, 20])
pygame.draw.rect(screen, YELLOW, [640, 220, 30, 20])
# The bottom row of 'windows' on the buildings
pygame.draw.rect(screen, YELLOW, [20, 270, 30, 20])
pygame.draw.rect(screen, YELLOW, [70, 270, 30, 20])
pygame.draw.rect(screen, YELLOW, [130, 270, 30, 20])
pygame.draw.rect(screen, YELLOW, [180, 270, 30, 20])
pygame.draw.rect(screen, YELLOW, [480, 270, 30, 20])
pygame.draw.rect(screen, YELLOW, [530, 270, 30, 20])
pygame.draw.rect(screen, YELLOW, [590, 270, 30, 20])
pygame.draw.rect(screen, YELLOW, [640, 270, 30, 20])
# The 'doors' on the buildings'
pygame.draw.rect(screen, BROWN, [35, 300, 50, 50])
pygame.draw.rect(screen, BROWN, [145, 300, 50, 50])
pygame.draw.rect(screen, BROWN, [495, 300, 50, 50])
pygame.draw.rect(screen, BROWN, [605, 300, 50, 50])

# Draw an arc as part of an ellipse.
# Use radians to determine what angle to draw.
pygame.draw.arc(screen, WHITE, [220, 150, 250, 200], 0, PI / 2, 2)
pygame.draw.arc(screen, GREEN, [220, 150, 250, 200], PI / 2, PI, 2)
pygame.draw.arc(screen, BLUE, [220, 150, 250, 200], PI, 3 * PI / 2, 2)
pygame.draw.arc(screen, YELLOW, [220, 150, 250, 200], 3 * PI / 2, 2 * PI, 2)

# Select the font to use, size, bold, italics
font = pygame.font.SysFont('Calibri', 25, True, False)

# Render the text. "True" means anti-aliased text.
# White is the color. This creates an image of the
# letters, but does not put it on the screen
text = font.render("Button to Destroy All", True, WHITE)

# Put the image of the text on the screen at 245x240
screen.blit(text, [245, 240])

pygame.display.flip()

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

# Close the window and quit.
<<<<<<< HEAD
pygame.quit()
=======
pygame.quit()
Loading