diff --git a/Homework_1.py b/Homework_1.py new file mode 100644 index 0000000..41dabe2 --- /dev/null +++ b/Homework_1.py @@ -0,0 +1,6 @@ +team = { + 1678: {"weight": 123, "color": "blue", "wheels": "green"} + 123: {"weight": 145, "color": "red", "wheels": "yellow"} + 9432: {"weight": 1678, "color": "green", "wheels": "blue"} +} +requested_team_number = input("Team Number: ") diff --git a/ch_1_assign_Jackson_Anglin-Hill.py b/ch_1_assign_Jackson_Anglin-Hill.py new file mode 100644 index 0000000..41c9ad2 --- /dev/null +++ b/ch_1_assign_Jackson_Anglin-Hill.py @@ -0,0 +1,50 @@ +teams = { + 1: { + 'location' : 'Flanders, New Jersey, USA', + 'rookie year' : 1999, + 'competed in 2019 competitions': 'Yes', + 'names of 2019 competitions': 'FIM District Center Line Event and FIM District Troy Event', + 'location of 2019 competitions': 'Center Line, MI, USA and Troy, MI, USA', + '2019 season award': 'Imagery Award' + }, + + 554: { + 'location' : 'Ft. Thomas, Kentucky, USA', + 'rookie year' : 2001, + 'competed in 2019 competitions': 'Yes', + 'names of 2019 competitions': 'Miami Valley Regional', + 'location of 2019 competitions': 'Dayton, OH 45435, USA', + '2019 season award': 'None' + }, + + 253: { + 'location' : 'Millbrae, California, USA', + 'rookie year': 1999, + 'competed in 2019 competitions': 'Yes', + 'names of 2019 competitions': 'San Francisco Regional, Monterey Bay Regional and Newton Division', + 'location of 2019 competitions': 'San Francisco, CA, USA, Seaside, CA, USA and Houston, TX, USA', + '2019 season award': 'Team Spirit Award' + }, + + 342: { + 'location' : 'North Charleston, South Carolina, USA', + 'rookie year' : 2000, + 'competed in 2019 competitions': 'Yes', + 'names of 2019 competitions': 'Palmetto Regional and Rocket City Regional', + 'location of 2019 competitions': 'Myrtle Beach, SC 29578, USA and Huntsville, AL 35801, USA', + '2019 season award': 'None' + }, + + 16: { + 'location' : 'Mountain Home, Arkansas, USA', + 'rookie year' : 1996, + 'competed in 2019 competitions': 'Yes', + 'names of 2019 competitions': 'Midwest Regional, Rocket City Regional and Darwin Division', + 'location of 2019 competitions': 'Detroit, MI, USA and Huntsville, AL 35801, USA', + '2019 season award': 'Industrial Design Award, Regional Finalists and Excellence in Engineering Award' + } +} +print("You must enter options exactly as they are displayed. If they are entered incorrectly, you will not receive any information.") +team_number = int(input("Please enter team number. You can enter '1, 554, 253, 342, or 16': ")) +team_attribute = input("Please enter team attribute. You can enter 'location, rookie year, competed in 2019 competitions, names of 2019 competitions, location of 2019 competitions, or 2019 season award': ") +print(teams[team_number][team_attribute]) \ No newline at end of file diff --git a/ch_1_lesson_Jackson_Anglin-Hill.py b/ch_1_lesson_Jackson_Anglin-Hill.py new file mode 100644 index 0000000..8c854ae --- /dev/null +++ b/ch_1_lesson_Jackson_Anglin-Hill.py @@ -0,0 +1 @@ +print('Hello, world!') \ No newline at end of file diff --git a/ch_2_assignment_Jackson_Anglin-Hill.py b/ch_2_assignment_Jackson_Anglin-Hill.py new file mode 100644 index 0000000..2020fb4 --- /dev/null +++ b/ch_2_assignment_Jackson_Anglin-Hill.py @@ -0,0 +1,233 @@ +on = True +#teams is a dictionary with teams numbers as the keys and their information as the definitions. +teams = {} +#team_names is a list containing the names of the teams. +allowed_actions_1 = [ + 'Add team', + 'Remove team', + 'View team information', + 'Modify team information', + 'Search for team', + 'List all teams' + ] + +while on: + print(allowed_actions_1) + request = input('What would you like to do?: ') + request = request.lower() + while request == 'add team': + while True: + requested_team = input('Input team number: ') + try: + requested_team = int(requested_team) + break + except: + print("Enter the team number with no letters.") + request = 'add team' + if requested_team in teams: + print('This team is already in the system. Please add a different team, confirm you have entered the team number correctly, or edit the information already existing in this team.') + else: + name = input('What is the team name?: ') + program = input('What programming language do they use?: ') + while True: + width = input('What is the width of the robot in centimeters?: ') + try: + width = int(width) + break + except: + print("Please use numbers.") + while True: + length = input('What is the length of the robot in centimeters?: ') + try: + length = int(length) + break + except: + print("Please use numbers.") + while True: + camera = input('Do they have a camera system?: ') + camera = camera.lower() + if camera == 'yes': + camera = True + break + elif camera == 'no': + camera = False + break + else: + print("Please enter 'Yes' or 'No'") + while True: + drivetrain = input('How many drivetrain motors do they have?: ') + try: + drivetrain = int(drivetrain) + break + except: + print("Please use numbers.") + teams[requested_team] = {} + teams[requested_team]['Name'] = name + teams[requested_team]['Program'] = program + teams[requested_team]['Width'] = width + teams[requested_team]['Length'] = length + teams[requested_team]['Camera'] = camera + teams[requested_team]['Drivetrain#'] = drivetrain + while True: + uncontinue = input("Would you like to add another team? Enter 'Yes' 'No': ") + uncontinue = uncontinue.lower() + if uncontinue == 'no': + request = 'o' + elif uncontinue.lower() == 'yes': + request = 'add team' + else: + print('That is not a valid entry. You will be automatically sent back to the main menu.') + reqest = 'o' + while request == 'remove team': + print(teams.keys()) + while True: + requested_team = input('Input team number: ') + try: + requested_team = int(requested_team) + break + except: + print('Enter team number without letters.') + if requested_team in teams: + teams.pop(requested_team) + else: + print('Team not found. Try another team or make sure you entered the team number correctly.') + while True: + uncontinue = input("Would you like to remove another team? Enter 'Yes' 'No': ") + uncontinue = uncontinue.lower() + if uncontinue.lower() == 'no': + request = 'o' + elif uncontinue.lower() == 'yes': + request = 'remove team' + else: + print('That is not a valid entry. You will be automatically sent back to the main menu.') + request = 'o' + while request == 'view team information': + while True: + requested_team = input('Input team number: ') + try: + requested_team = int(requested_team) + break + except: + print("Enter the team number with no letters.") + if requested_team in teams: + print(teams[requested_team]) + else: + print('Team not found. Try another team or make sure you entered the team number correctly.') + while True: + uncontinue = input("Would you like to view another team? Enter 'Yes' 'No': ") + uncontinue = uncontinue.lower() + if uncontinue.lower() == 'no': + request = 'o' + elif uncontinue.lower() == 'yes': + request = 'view team information' + else: + print('That is not a valid entry. You will be automatically sent back to the main menu.') + request = 'o' + while request == 'modify team information': + print(teams.keys()) + while True: + requested_team = input('Input team number: ') + try: + requested_team = int(requested_team) + break + except: + print("Enter the team number with no letters.") + request = 'modify team information' + break + if requested_team in teams: + change = input("What would you like to change for this team? Enter 'Name' 'Program' 'Width' 'Length' 'Camera' 'Drivetraincount': ") + try: + change = str(change.lower()) + except: + print('Do not use numbers while entering the requested section') + request = 'modify team information' + break + if change == 'name': + name = input('What is the team name?: ') + teams[requested_team]['Name'] = name + elif change == 'program': + program = input('What program is the team using?: ') + teams[requested_team]['Program'] = program + elif change == 'Width': + while True: + width = input('What width is the robot in centimeters?: ') + try: + width = int(width) + break + except: + print("Please use numbers.") + teams[requested_team]['Width'] = width + elif change == 'length': + while True: + length = input('What length is the robot in centimeters?: ') + try: + length = int(length) + break + except: + print("Please use numbers.") + teams[requested_team]['Length'] = length + elif change == 'camera': + while True: + camera = input('Do they have a camera system?: ') + try: + camera = camera.lower() + except: + print("Please enter 'Yes' or 'No'") + if camera == 'yes': + camera = True + break + elif camera == 'no': + camera = False + break + else: + print("Please enter 'Yes' or 'No'") + teams[requested_team]['Camera'] = camera + elif change == 'drivetraincount': + while True: + drivetrain = input('How many drivetrains is the robot using?: ') + try: + drivetrain = int(drivetrain) + break + except: + print("Please use numbers.") + teams[requested_team]['Drivetraincount'] = drivetrain + else: + print('Team not found. Try another team or make sure you entered the team number correctly.') + while True: + uncontinue = input("Would you like to modify another team? Enter 'Yes' 'No': ") + uncontinue = uncontinue.lower() + if uncontinue.lower() == 'no': + request = 'o' + elif uncontinue.lower() == 'yes': + request = 'modify team information' + else: + print('That is not a valid entry. You will be automatically sent back to the main menu.') + request = 'o' + + while request == 'search for team': + while True: + requested_team = input("Which team would you like to confirm is in our database? If no response is given from your entry, the team is not in our database.: ") + try: + requested_team = int(requested_team) + if requested_team in teams: + print("Requested team is in database. You can view its information using command 'View team information' and entering the team number again.") + break + except: + requested_team.lower() + for team in teams.values(): + if team['Name'] == requested_team: + print("Requested team is in database. You can view its information using command 'View team information' and entering the team number again.") + break + while True: + uncontinue = input("Would you like to search for another team? Enter 'Yes' 'No': ") + uncontinue = uncontinue.lower() + if uncontinue.lower() == 'no': + request = 'o' + elif uncontinue.lower() == 'yes': + request = 'search for team' + else: + print('That is not a valid entry. You will be automatically sent back to the main menu.') + request = 'o' + if request == 'list all teams': + print(teams.keys()) + request = 'o' \ No newline at end of file diff --git a/ch_3_assign_Jackson_Anglin-Hill.py b/ch_3_assign_Jackson_Anglin-Hill.py new file mode 100644 index 0000000..98d53ce --- /dev/null +++ b/ch_3_assign_Jackson_Anglin-Hill.py @@ -0,0 +1,187 @@ +teams = {} +allowed_actions = [ + 'Add team', + 'Remove team', + 'View team information', + 'Modify team information', + 'Search for team', + 'List all teams' + ] + +running = True +def mainMenu(): + print(allowed_actions) +def addTeam(): + while True: + requested_team = input('Input team number: ') + try: + requested_team = int(requested_team) + break + except: + print('Enter the team number without letters.') + if requested_team in teams: + print('This team is already in the system. Please add a different team, confirm you have entered the team number correctly, or edit the information already existing in this team.') + else: + location = input('What is the location of the team?: ') + while True: + rookie_year = input('What is their rookie year?: ') + try: + rookie_year = int(rookie_year) + break + except: + print('Enter rookie year without letters.') + while True: + competed_in_2019 = input('Did they compete in the 2019 competitions?: ') + try: + competed_in_2019 = competed_in_2019.lower() + except: + print("Please enter 'Yes' or 'No'") + if competed_in_2019 == 'yes': + competed_in_2019 = True + break + elif competed_in_2019 == 'no': + competed_in_2019 == False + break + else: + print("Please enter 'Yes' or 'No'") + competitions = input('If they did, what are the names of the competitions they participated in?: ') + locations_of_competitions = input('If they did, what are the locations of the competitions they participated in?: ') + awards_won = input('If they won any, what awards did they win?: ') + teams[requested_team] = {} + teams[requested_team]['Location'] = location + teams[requested_team]['Rookie Year'] = rookie_year + teams[requested_team]['Competed in 2019 Competitions'] = competed_in_2019 + teams[requested_team]['Competition Names'] = competitions + teams[requested_team]['Competition Locations'] = locations_of_competitions + teams[requested_team]['Awards Won'] = awards_won + +def removeTeam(): + print(teams.keys()) + while True: + requested_team = input('Input team number: ') + try: + requested_team = int(requested_team) + break + except: + print('Enter team number without letters.') + if requested_team in teams: + teams.pop(requested_team) + else: + print('Team not found. Try another team or make sure you entered the team number correctly.') + +def viewTeam(): + print(teams.keys()) + while True: + requested_team = input('Input team number: ') + try: + requested_team = int(requested_team) + break + except: + print('Enter team number without letters.') + if requested_team in teams: + print(teams[requested_team]) + else: + print('Team not found. Try another team or make sure you entered the team number correctly.') + +def modifyTeam(): + print(teams.keys()) + while True: + requested_team = input('Input team number: ') + try: + requested_team = int(requested_team) + break + except: + print('Enter team number without letters.') + if requested_team in teams: + change = input("What would you like to change for this team? Enter 'Location' 'Rookie Year' 'Competed in Competitions' 'Competition Names' 'Competition Locations' 'Awards Won': ") + change = change.lower() + if change == 'location': + location = input('Where is the team located?: ') + teams[requested_team]['Location'] = location + elif change == 'rookie year': + while True: + rookie_year = input('What is their rookie year?: ') + try: + rookie_year = int(rookie_year) + break + except: + print('Enter rookie year without letters.') + teams[requested_team]['Rookie Year'] = rookie_year + elif change == 'competed in competitions': + while True: + competed_in_2019 = input('Did they compete in the 2019 competitions?: ') + try: + competed_in_2019 = competed_in_2019.lower() + except: + print("Please enter 'Yes' or 'No'") + if competed_in_2019 == 'yes': + competed_in_2019 = True + break + elif competed_in_2019 == 'no': + competed_in_2019 == False + break + else: + print("Please enter 'Yes' or 'No'") + teams[requested_team]['Competed in 2019 Competitions'] = competed_in_2019 + elif change == 'competition names': + competitions = input('What are the names of the competitions they participated in?: ') + teams[requested_team]['Competition Names'] = competitions + elif change == 'competition locations': + locations_of_competitions = input('Where were the competitions they participated in?: ') + teams[requested_team]['Competition Locations'] = locations_of_competitions + elif change == 'awards won': + awards_won = input('What awards did they win?: ') + teams[requested_team]['Awards Won'] = awards_won + else: + print('Team not found. Try another team or make sure you entered the team number correctly.') + +def searchTeam(): + while True: + requested_team = input("Which team would you like to confirm is in our database? If no response is given from your entry, the team is not in our database.: ") + try: + requested_team = int(requested_team) + if requested_team in teams: + print("Requested team is in database. You can view its information using command 'View team information' and entering the team number again.") + break + except: + requested_team.lower() + for team in teams.values(): + if team['Name'] == requested_team: + print("Requested team is in database. You can view its information using command 'View team information' and entering the team number again.") + break +def uncontinue(): + while True: + uncontinue = input("Would you like to repeat this action?: ") + if uncontinue.lower() == 'no': + return True + elif uncontinue.lower() == 'yes': + return False + else: + return True +while running: + mainMenu() + request = input('What would you like to do?: ') + request = request.lower() + while request == 'add team': + addTeam() + if uncontinue(): + request = 'o' + while request == 'remove team': + removeTeam() + if uncontinue(): + request = 'o' + while request == 'view team information': + viewTeam() + if uncontinue(): + request = 'o' + while request == 'modify team information': + modifyTeam() + if uncontinue(): + request = 'o' + while request == 'search for team': + searchTeam() + if uncontinue(): + request = 'o' + if request == 'list all teams': + print(teams.keys()) + request = 'o' \ No newline at end of file diff --git a/ch_4_assign_Jackson_Antlin-Hill.py b/ch_4_assign_Jackson_Antlin-Hill.py new file mode 100644 index 0000000..c86637a --- /dev/null +++ b/ch_4_assign_Jackson_Antlin-Hill.py @@ -0,0 +1,66 @@ +import math +class Points: + def __init__ (self, x, y): + self.x = x + self.y = y + def Distance(self): + return float(math.sqrt((self.x ** 2) + (self.y ** 2))) + +class Points_3D(Points): + def __init__(self, x, y, z): + super().__init__(x, y) + self.z = z + def Distance_3D(self): + return float(math.sqrt((self.x ** 2) + (self.y ** 2) + (self.z ** 2))) +while 0 == 0: + activated = "On" + while activated == 'On': + validation_1_x = input('What is the x value of Point 1?: ') + validation_1_y = input('What is the y value of Point 1?: ') + validation_2_x = input('What is the x value of Point 2?: ') + validation_2_y = input('What is the y value of Point 2?: ') + validation_2_z = input('What is the z value of Point 2?: ') + try: + point_1_x = float(validation_1_x) + except: + print("Only intergers are allowed.") + activated = 'Off' + try: + point_1_y = float(validation_1_y) + except: + print("Only intergers are allowed.") + activated = 'Off' + try: + point_2_x = float(validation_2_x) + except: + print("Only intergers are allowed.") + activated = 'Off' + try: + point_2_y = float(validation_2_y) + except: + print("Only intergers are allowed.") + activated = 'Off' + try: + point_2_z = float(validation_2_z) + except: + print("Only intergers are allowed.") + activated = 'Off' + if activated == 'Off': + print('You entered something that was not an interger. Please try again using only numbers.') + else: + point_1 = Points(point_1_x, point_1_y) + point_2 = Points_3D(point_2_x, point_2_y, point_2_z) + point_2_xy = Points(point_2_x, point_2_y) + + if point_1.Distance() > point_2.Distance_3D(): + print('Point 1 is further from the origin than Point 2, with a distance of ' + str(point_1.Distance()) + '.') + elif point_2.Distance_3D() > point_1.Distance(): + print('Point 2 is further from the origin than Point 1, with a distance of ' + str(point_2.Distance_3D()) + '.') + elif point_1.Distance() == point_2.Distance_3D(): + print('The points are the same distance from the origin, with a distance of ' + str(point_1.Distance()) + '.') + if point_1.Distance() > point_2_xy.Distance(): + print('Point 1 is further from the origin on the xy axis than Point 2, with a distance of ' + str(point_1.Distance()) + '.') + elif point_2_xy.Distance() > point_1.Distance(): + print('Point 2 is further from the origin on the xy axis than Point 1, with a distance of ' + str(point_2_xy.Distance()) + '.') + elif point_1.Distance() == point_2_xy.Distance(): + print('The points are the same distance from the origin on the xy axis, with a distance of ' + str(point_1.Distance()) + '.') \ No newline at end of file