From 45ea8749872766c0858356cc773786fb083b282d Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Thu, 12 Sep 2019 19:33:02 -0700 Subject: [PATCH 01/36] added lesson file --- "\"ch_1_lesson_sophia_palomares.py\"" | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 "\"ch_1_lesson_sophia_palomares.py\"" diff --git "a/\"ch_1_lesson_sophia_palomares.py\"" "b/\"ch_1_lesson_sophia_palomares.py\"" new file mode 100644 index 0000000..eb3d840 --- /dev/null +++ "b/\"ch_1_lesson_sophia_palomares.py\"" @@ -0,0 +1,3 @@ +"ch_1_lesson_sophia_palomares.py" + +print('Hello, World') \ No newline at end of file From 7982e531e6b54970506a84a49732b3b0f551ff6d Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Thu, 12 Sep 2019 20:48:05 -0700 Subject: [PATCH 02/36] Add team info for assignment --- ch_1_assign_sophia_palomares.py | 37 +++++++++++++++++++++++++++++++++ ch_1_lesson_sophia_palomares.py | 3 +++ 2 files changed, 40 insertions(+) create mode 100644 ch_1_assign_sophia_palomares.py create mode 100644 ch_1_lesson_sophia_palomares.py diff --git a/ch_1_assign_sophia_palomares.py b/ch_1_assign_sophia_palomares.py new file mode 100644 index 0000000..52febca --- /dev/null +++ b/ch_1_assign_sophia_palomares.py @@ -0,0 +1,37 @@ +teams = [ + 1678, + 1690 +]#teams number +rookie = { + 1678 : 2005, + 1690 : 2005 +}#teams starting year +location = { + 1678: "Davis, CA, USA", + 1690: "Binyamina, HaZafon, Israel" +}#team locations +compete_1678 = True +compete_1690 = True +compitions_1678 = { + "Central Valley Regional" : "Fresno, Ca, USA", + "Sacramento Reagional": "Sacramento, CA, USA", + "Aerospace Valley Regional": "Lancaster, CA, USA", + "Carver Division": "Houston, TX, USA", + "Einstein Field": "Houston, TX, USA" +} #1678 2019 compitions and locations +compitions_1690 = { + "ISR District Event #1" : "Haifa, HA 00000, Israel", + "ISR District Event #4" : "Tel Aviv-Yafo, TA 00000, Israel", + "FIRST Israel District Championship": "Tel Aviv-Yafo, TA 00000, Israel", + "Darwin Division": "Detroit, MI, USA", + "Indiana Robotics Invitational": "Indianapolis, IN, USA" +} #1690 2019 compititions and locations +awards_1678 = [ + "Chairman's Award", + "Central Valley Regional Winner", + "Sacramento Regional Winner", + "Aerospace Valley Regional Winner" +]#1678 2019 awards +awards_1690 = [] + +team_number = input \ No newline at end of file diff --git a/ch_1_lesson_sophia_palomares.py b/ch_1_lesson_sophia_palomares.py new file mode 100644 index 0000000..eb3d840 --- /dev/null +++ b/ch_1_lesson_sophia_palomares.py @@ -0,0 +1,3 @@ +"ch_1_lesson_sophia_palomares.py" + +print('Hello, World') \ No newline at end of file From 9b066a1b0509b2079c144ee3416c229cfec66c5a Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Sat, 14 Sep 2019 16:37:50 -0700 Subject: [PATCH 03/36] Add requirements. Maybe complete --- ch_1_assign_sophia_palomares.py | 383 +++++++++++++++++++++++++++++--- 1 file changed, 355 insertions(+), 28 deletions(-) diff --git a/ch_1_assign_sophia_palomares.py b/ch_1_assign_sophia_palomares.py index 52febca..8a9ede0 100644 --- a/ch_1_assign_sophia_palomares.py +++ b/ch_1_assign_sophia_palomares.py @@ -1,37 +1,364 @@ -teams = [ - 1678, - 1690 -]#teams number +def team_info(): + teams = input("What team would you like to look up? options: 1678, 1682, 1690, 1700, 2907, 3132 ") + #1678 + if(teams == "1678"): + print("You chose team 1678, or Citrus Circuits") + info_question_1678 = input("Would you like to know about the team ") + if(info_question_1678 == "rookie year"): + print(rookie[1678]) + team_info() + elif(info_question_1678 == "location"): + print(location[1678]) + team_info() + elif(info_question_1678 == "competed in 2019"): + if(compete_1678 == True): + print("Yes, this team did compete in 2019") + comp_1678_question = input("Would you like to know the competitions this team competed in?") + if (comp_1678_question == "yes"): + print(competitions_1678) + comp_location_question_1678 = input("Would you like to know where those competitions are located? ") + if(comp_location_question_1678 == "yes"): + print(competitions_locations_1678["1"]) + print(competitions_locations_1678["2"]) + print(competitions_locations_1678["3"]) + print(competitions_locations_1678["4"]) + print(competitions_locations_1678["5"]) + team_info() + else: + print("You chose not to look at where the competitions are located") + team_info() + else: + print("You chose not to look at the competitions") + team_info() + else: + print("Didn't compete in 2019") + team_info() + elif(info_question_1678 == "awards in 2019"): + print(awards_1678) + team_info() + else: + print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, competitions in 2019, and awards in 2019. Please copy them exactly") + team_info() + #1682 + elif(teams == "1682"): + print("You chose team 1682, or Eye Bots") + info_question_1682 = input("Would you like to know about the team ") + if(info_question_1682 == "rookie year"): + print(rookie[1682]) + team_info() + elif(info_question_1682 == "location"): + print(location[1682]) + team_info() + elif(info_question_1682 == "competed in 2019"): + if(compete_1682 == True): + print("Yes, this team did compete in 2019") + comp_1682_question = input("Would you like to know the competitions this team competed in?") + if (comp_1682_question == "yes"): + print(competitions_1682) + comp_location_question_1682 = input("Would you like to know where those competitions are located? ") + if(comp_location_question_1682 == "yes"): + print(competitions_locations_1682["1"]) + team_info() + else: + print("You chose not to look at where the competitions are located") + team_info() + else: + print("You chose not to look at the competitions") + team_info() + else: + print("Didn't compete in 2019") + team_info() + elif(info_question_1682 == "awards in 2019"): + print(awards_1682) + else: + print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, competitions in 2019, and awards in 2019. Please copy them exactly") + #1690 + elif(teams == "1690"): + print("You chose team 1690, or Orbit") + info_question_1690 = input("Would you like to know about the team ") + if(info_question_1690 == "rookie year"): + print(rookie[1690]) + team_info() + elif(info_question_1690 == "location"): + print(location[1690]) + team_info() + elif(info_question_1690 == "competed in 2019"): + if(compete_1690 == True): + print("Yes, this team did compete in 2019") + comp_1690_question = input("Would you like to know the competitions this team competed in?") + if (comp_1690_question == "yes"): + print(competitions_1690) + comp_location_question_1690 = input("Would you like to know where those competitions are located? ") + if(comp_location_question_1690 == "yes"): + print(competitions_locations_1690["1"]) + print(competitions_locations_1690["2"]) + print(competitions_locations_1690["3"]) + print(competitions_locations_1690["4"]) + print(competitions_locations_1690["5"]) + team_info() + else: + print("You chose not to look at where the competitions are located") + team_info() + else: + print("You chose not to look at the competitions") + team_info() + else: + print("Didn't compete in 2019") + team_info() + elif(info_question_1690 == "awards in 2019"): + print(awards_1690) + team_info() + else: + print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, competitions in 2019, and awards in 2019. Please copy them exactly") + team_info() + #1700 + elif(teams == "1700"): + print("You chose team 1700, or Gatorbotics") + info_question_1700 = input("Would you like to know about the team ") + if(info_question_2907 == "rookie year"): + print(rookie[1700]) + team_info() + elif(info_question_1700 == "location"): + print(location[1700]) + team_info() + elif(info_question_1700 == "competed in 2019"): + if(compete_1700 == True): + print("Yes, this team did compete in 2019") + comp_1700_question = input("Would you like to know the competitions this team competed in?") + if (comp_1700_question == "yes"): + print(competitions_1700) + comp_location_question_1700 = input("Would you like to know where those competitions are located? ") + if(comp_location_question_1700 == "yes"): + print(competitions_locations_1700["1"]) + print(competitions_locations_1700["2"]) + print(competitions_locations_1700["3"]) + print(competitions_locations_1700["4"]) + print(competitions_locations_1700["5"]) + print(competitions_locations_1700["6"]) + print(competitions_locations_1700["7"]) + else: + print("You chose not to look at where the competitions are located") + team_info() + else: + print("You chose not to look at the competitions") + team_info() + else: + print("Didn't compete in 2019") + elif(info_question_1700 == "awards in 2019"): + print(awards_1700) + team_info() + else: + print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, competitions in 2019, and awards in 2019. Please copy them exactly") + team_info() + #2907 + elif(teams == "2907"): + print("You chose team 2907, or Lion Robotics") + info_question_2907 = input("Would you like to know about the team ") + if(info_question_2907 == "rookie year"): + print(rookie[2907]) + team_info() + elif(info_question_2907 == "location"): + print(location[2907]) + team_info() + elif(info_question_2907 == "competed in 2019"): + if(compete_2907 == True): + print("Yes, this team did compete in 2019") + comp_2907_question = input("Would you like to know the competitions this team competed in?") + if (comp_2907_question == "yes"): + print(competitions_2907) + comp_location_question_2907 = input("Would you like to know where those competitions are located? ") + if(comp_location_question_2907 == "yes"): + print(competitions_locations_2907["1"]) + print(competitions_locations_2907["2"]) + print(competitions_locations_2907["3"]) + team_info() + else: + print("You chose not to look at where the competitions are located") + team_info() + else: + print("You chose not to look at the competitions") + team_info() + else: + print("Didn't compete in 2019") + team_info() + elif(info_question_2907 == "awards in 2019"): + print(awards_2907) + else: + print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, competitions in 2019, and awards in 2019. Please copy them exactly") + #3132 + elif(teams == "3132"): + print("You chose team 3132, or Thunder Down Under") + info_question_3132 = input("Would you like to know about the team ") + if(info_question_3132 == "rookie year"): + print(rookie[3132]) + team_info() + elif(info_question_3132 == "location"): + print(location[3132]) + team_info() + elif(info_question_3132 == "competed in 2019"): + if(compete_3132 == True): + print("Yes, this team did compete in 2019") + comp_3132_question = input("Would you like to know the competitions this team competed in? ") + if (comp_3132_question == "yes"): + print(competitions_3132) + comp_location_question_3132 = input("Would you like to know where those competitions are located? ") + if(comp_location_question_3132 == "yes"): + print(competitions_locations_3132["1"]) + print(competitions_locations_3132["2"]) + print(competitions_locations_3132["3"]) + print(competitions_locations_3132["4"]) + print(competitions_locations_3132["5"]) + team_info() + else: + print("You chose not to look at where the competitions are located") + team_info() + else: + print("You chose not to look at the competitions") + team_info() + else: + print("Didn't compete in 2019") + team_info() + elif(info_question_3132 == "awards in 2019"): + print(awards_3132) + else: + print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, competitions in 2019, and awards in 2019. Please copy them exactly") + + + +#General Info +team_numbers =[ + 1678, + 1682, + 1690, + 1700, + 2907, + 3132, +]#team numbers rookie = { - 1678 : 2005, - 1690 : 2005 + 1678 : 2005, + 1682 : 2005, + 1690 : 2005, + 1700 : 2005, + 2907 : 2009, + 3132 : 2010, }#teams starting year location = { - 1678: "Davis, CA, USA", - 1690: "Binyamina, HaZafon, Israel" + 1678: "Davis, California, USA", + 1682: "Riverside, CA, USA", + 1690: "Binyamina, HaZafon, Israel", + 1700: "Palo Alto, California, USA", + 2907: "Auburn, Washington, USA", + 3132: "Sydney, New South Wales, Australia", }#team locations compete_1678 = True +compete_1682 = False compete_1690 = True -compitions_1678 = { - "Central Valley Regional" : "Fresno, Ca, USA", - "Sacramento Reagional": "Sacramento, CA, USA", - "Aerospace Valley Regional": "Lancaster, CA, USA", - "Carver Division": "Houston, TX, USA", - "Einstein Field": "Houston, TX, USA" -} #1678 2019 compitions and locations -compitions_1690 = { - "ISR District Event #1" : "Haifa, HA 00000, Israel", - "ISR District Event #4" : "Tel Aviv-Yafo, TA 00000, Israel", - "FIRST Israel District Championship": "Tel Aviv-Yafo, TA 00000, Israel", - "Darwin Division": "Detroit, MI, USA", - "Indiana Robotics Invitational": "Indianapolis, IN, USA" -} #1690 2019 compititions and locations +compete_1700 = True +compete_2907 = True +compete_3132 = True + +#1678 +competitions_1678 = [ + "Central Valley Regional", + "Sacramento Reagional", + "Aerospace Valley Regional", + "Carver Division", + "Einstein Field" +] #1678 2019 competitions +competitions_locations_1678 = { + "1" : "Central Valley Regional: Fresno, Ca, USA", + "2": "Sacramento Reagional: Sacramento, CA, USA", + "3": "Aerospace Valley Regional: Lancaster, CA, USA", + "4": "Carver Division: Houston, TX, USA", + "5": "Einstein Field: Houston, TX, USA" +} #1678 2019 competitions and locations awards_1678 = [ - "Chairman's Award", - "Central Valley Regional Winner", - "Sacramento Regional Winner", - "Aerospace Valley Regional Winner" + "CHAIRMAN'S AWARD", + "CENTRAL VALLEY REGIONAL WINNER", + "SACRAMENTO REGIONAL WINNER", + "AEROSPACE VALLEY REGIONAL WINNER" ]#1678 2019 awards -awards_1690 = [] -team_number = input \ No newline at end of file +#1682 +competitions_1682 = [] +competitions_locations_1682 = {} +award_1682 = ["None"] + +#1690 +competitions_1690 = [ + "ISR District Event #1", + "ISR District Event #4" + "FIRST Israel District Championship" + "Darwin Division" + "Indiana Robotics Invitational" +] #1690 2019 competitions +competitions_locations_1690 = { + "1" : "ISR District Event #1: Haifa, HA 00000, Israel", + "2" : "ISR District Event #4: Tel Aviv-Yafo, TA 00000, Israel", + "3": "FIRST Israel District Championship: Tel Aviv-Yafo, TA 00000, Israel", + "4": "Darwin Division: Detroit, MI, USA", + "5": "Indiana Robotics Invitational: Indianapolis, IN, USA" +} #1690 2019 competitions and locations +awards_1690 = ["None"] #1690 awards + +#1700 +competitions_1700 = [ + "San Francisco Regionals", + "Utah Regionals", + "Turing Devision" +] +competitions_locations_1700 = { + "1" : "San Francisco Regionals: San Francisco, CA, USA", + "2" : "Utah Regionals: West Valley City, Utah, USA", + "3" : "Turing Devision: Houston, TX, USA" + +} +award_1700 = ["None"] + +#2907 +competitions_2907 = [ + "PNW District Auburn Mountainview Event", + "PNW District West Valley Event", + "PNW District Auburn Event", + "Pacific Northwest FIRST District Championship", + "Roebling Division", + "Einstein Field", + "Peak Performance", + + +] +competitions_locations_2907 = { + "1" : "PNW District Auburn Mountainview Event: Auburn, WA, USA", + "2" : "NW District West Valley Event: Spokane, WA, USA", + "3" : "PNW District Auburn Event: Auburn, WA, USA", + "4" : "Pacific Northwest FIRST District Championship: Tacoma, WA, USA", + "5" : "Roebling Division: Houston, TX, USA", + "6" : "Einstein Field: Houston, TX, USA", + "7" : "Peak Performance: Sea Tac, WA, USA" +} +award_2907 = [ + "2019 PACIFIC NORTHWEST FIRST DISTRICT CHAMPIONSHIP", + "2019 ROEBLING DIVISION" +] + +#3132 +competitions_3132 = [ + "Southern Cross Regional", + "South Pacific Regional", + "Carver Division", + "Einstein Field", + "Duel Down Under", +] +competitions_locations_3132 = { + "1" : "Southern Cross Regional: Sydney Olympic Park, NSW, Australia", + "2" : "NSouth Pacific Regional: Sydney Olympic Park, NSW, Australia", + "3" : "Carver Division: Houston, TX, USA", + "4" : "Einstein Field: Houston, TX, USA", + "5" : "Duel Down Under: Sydney, New South Wales, Australia" +} +award_3132 = [ + "2019 SOUTHERN CROSS REGIONAL", + "2019 CARVER DIVISION" +] + +team_info() \ No newline at end of file From c2fdc05e22e788af7da4bbbfb24c5cd4693b3554 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Sun, 15 Sep 2019 16:44:50 -0700 Subject: [PATCH 04/36] Add final edits and complete assignment --- ch_1_assign_sophia_palomares.py | 34 +++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/ch_1_assign_sophia_palomares.py b/ch_1_assign_sophia_palomares.py index 8a9ede0..70bbacf 100644 --- a/ch_1_assign_sophia_palomares.py +++ b/ch_1_assign_sophia_palomares.py @@ -1,9 +1,9 @@ def team_info(): - teams = input("What team would you like to look up? options: 1678, 1682, 1690, 1700, 2907, 3132 ") + teams = input("What team would you like to look up? options: 1678, 1682, 1690, 1700, 2907, 3132, or Exit ") #1678 if(teams == "1678"): print("You chose team 1678, or Citrus Circuits") - info_question_1678 = input("Would you like to know about the team ") + info_question_1678 = input("Would you like to know about the team? Your options are rookie year, location , and competed in 2019. ") if(info_question_1678 == "rookie year"): print(rookie[1678]) team_info() @@ -37,12 +37,12 @@ def team_info(): print(awards_1678) team_info() else: - print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, competitions in 2019, and awards in 2019. Please copy them exactly") + print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, and awards in 2019. Please copy them exactly") team_info() #1682 elif(teams == "1682"): print("You chose team 1682, or Eye Bots") - info_question_1682 = input("Would you like to know about the team ") + info_question_1682 = input("Would you like to know about the team? Your options are rookie year, location , and competed in 2019. ") if(info_question_1682 == "rookie year"): print(rookie[1682]) team_info() @@ -71,11 +71,11 @@ def team_info(): elif(info_question_1682 == "awards in 2019"): print(awards_1682) else: - print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, competitions in 2019, and awards in 2019. Please copy them exactly") + print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, and awards in 2019. Please copy them exactly") #1690 elif(teams == "1690"): print("You chose team 1690, or Orbit") - info_question_1690 = input("Would you like to know about the team ") + info_question_1690 = input("Would you like to know about the team? Your options are rookie year, location , and competed in 2019. ") if(info_question_1690 == "rookie year"): print(rookie[1690]) team_info() @@ -109,12 +109,12 @@ def team_info(): print(awards_1690) team_info() else: - print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, competitions in 2019, and awards in 2019. Please copy them exactly") + print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, and awards in 2019. Please copy them exactly") team_info() #1700 elif(teams == "1700"): print("You chose team 1700, or Gatorbotics") - info_question_1700 = input("Would you like to know about the team ") + info_question_1700 = input("Would you like to know about the team? Your options are rookie year, location , and competed in 2019. ") if(info_question_2907 == "rookie year"): print(rookie[1700]) team_info() @@ -148,12 +148,12 @@ def team_info(): print(awards_1700) team_info() else: - print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, competitions in 2019, and awards in 2019. Please copy them exactly") + print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, and awards in 2019. Please copy them exactly") team_info() #2907 elif(teams == "2907"): print("You chose team 2907, or Lion Robotics") - info_question_2907 = input("Would you like to know about the team ") + info_question_2907 = input("Would you like to know about the team? Your options are rookie year, location , and competed in 2019. ") if(info_question_2907 == "rookie year"): print(rookie[2907]) team_info() @@ -184,11 +184,11 @@ def team_info(): elif(info_question_2907 == "awards in 2019"): print(awards_2907) else: - print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, competitions in 2019, and awards in 2019. Please copy them exactly") + print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019 and awards in 2019. Please copy them exactly") #3132 elif(teams == "3132"): print("You chose team 3132, or Thunder Down Under") - info_question_3132 = input("Would you like to know about the team ") + info_question_3132 = input("Would you like to know about the team? Your options are rookie year, location , and competed in 2019. ") if(info_question_3132 == "rookie year"): print(rookie[3132]) team_info() @@ -220,10 +220,16 @@ def team_info(): team_info() elif(info_question_3132 == "awards in 2019"): print(awards_3132) + team_info() else: - print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, competitions in 2019, and awards in 2019. Please copy them exactly") - + print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, and awards in 2019. Please copy them exactly") + #End Program + elif(teams == "Exit"): + print("You chose to exit this program") + else: + print("I'm sorry I don't know what team you asked. You can look up teams 1678, 1682, 1690, 1700, 2907, 3132 or you can enter Exit and leave the program.") + team_info() #General Info team_numbers =[ From 6b6683e258f7d07bce1276b24b5d51f25e5a02b4 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Fri, 20 Sep 2019 20:20:05 -0700 Subject: [PATCH 05/36] Add main components. Need to debug search aspect --- ch_2_assign_sophia_palomares.py | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 ch_2_assign_sophia_palomares.py diff --git a/ch_2_assign_sophia_palomares.py b/ch_2_assign_sophia_palomares.py new file mode 100644 index 0000000..11c591c --- /dev/null +++ b/ch_2_assign_sophia_palomares.py @@ -0,0 +1,56 @@ +teams = {} +#make sure this is under 1 function + +def main_function(): + user_question_1 = input("What would you like to do? ") + if(user_question_1 == "Add Team"): + add_team() + main_function() + elif(user_question_1 == "Remove Team"): + print("Please use only the team's number") + remove_teams() + main_function() + elif(user_question_1 == "Search for Team"): + print("Please use only the team's number") + search_team() + main_function() + elif(user_question_1 == "List of Teams"): + list_team() + main_function() + else: + print("Input is unknown. Please input Add Team, Remove Team, List of Teams, or Search for Team.") + main_function() +def remove_teams(): + key = input("What team do you want to remove? ") + teams.pop(key, value) + +def add_team(): + temp_team_dictionary = {} + + name = input("What is the name of your team? ") + p_language = input("What is your team's programming language? ") + width = int(input("What is your team's robot's width? ")) + length = int(input("Wnat is your team's robot's length? ")) + cam_vision = input("Does your team's robot's have a camera vision system? ") + drive_motors = int(input("How many dritrain motors does your team have? ")) + + temp_team_dictionary["name"] = name + temp_team_dictionary["programming language"] = p_language + temp_team_dictionary["width"] = width + temp_team_dictionary["length"] = length + temp_team_dictionary["camera vision system"] = cam_vision + temp_team_dictionary["drivetrain motors"] = drive_motors + + team_number_input = int(input("Add a team number")) + teams[team_number_input] = temp_team_dictionary + +def search_team(): + team_search = input("What team do you want to search? ") + #how do I fix this + search = team_search.items() + print(teams[search]) + +def list_team(): + print(teams.keys()) + +main_function() \ No newline at end of file From eb77fde79898a40fb5c31b30f31d3b3851d0e915 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Sat, 21 Sep 2019 11:09:01 -0700 Subject: [PATCH 06/36] Add main components. --- ch_2_assign_sophia_palomares.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/ch_2_assign_sophia_palomares.py b/ch_2_assign_sophia_palomares.py index 11c591c..4dd1694 100644 --- a/ch_2_assign_sophia_palomares.py +++ b/ch_2_assign_sophia_palomares.py @@ -21,8 +21,8 @@ def main_function(): print("Input is unknown. Please input Add Team, Remove Team, List of Teams, or Search for Team.") main_function() def remove_teams(): - key = input("What team do you want to remove? ") - teams.pop(key, value) + key = int(input("What team do you want to remove? ")) + teams.pop(key) def add_team(): temp_team_dictionary = {} @@ -45,10 +45,20 @@ def add_team(): teams[team_number_input] = temp_team_dictionary def search_team(): - team_search = input("What team do you want to search? ") + user_search = int(input("What team do you want to search? ")) #how do I fix this - search = team_search.items() - print(teams[search]) + print("Team Name:") + print(teams[user_search]["name"]) + print("Programming Language:") + print(teams[user_search]["programming language"]) + print("Robot's Width:") + print(teams[user_search]["width"]) + print("Robot's Length:") + print(teams[user_search]["length"]) + print("Y/N Camera Vision System:") + print(teams[user_search]["camera vision system"]) + print("Number of Drivetrain Motors:") + print(teams[user_search]["drivetrain motors"]) def list_team(): print(teams.keys()) From ee472b344621a9d8729a678c6b3d3cc06dd1c301 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Sat, 21 Sep 2019 11:15:53 -0700 Subject: [PATCH 07/36] Add main components and add final touches --- ch_2_assign_sophia_palomares.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ch_2_assign_sophia_palomares.py b/ch_2_assign_sophia_palomares.py index 4dd1694..a24a709 100644 --- a/ch_2_assign_sophia_palomares.py +++ b/ch_2_assign_sophia_palomares.py @@ -17,8 +17,10 @@ def main_function(): elif(user_question_1 == "List of Teams"): list_team() main_function() + elif(user_question_1 == "Exit"): + break else: - print("Input is unknown. Please input Add Team, Remove Team, List of Teams, or Search for Team.") + print("Input is unknown. Please input Add Team, Remove Team, List of Teams, Search for Team, or Exit.") main_function() def remove_teams(): key = int(input("What team do you want to remove? ")) From dca2d6a13276050d7e543eea6d61a69962a8f4b6 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Sat, 21 Sep 2019 11:23:58 -0700 Subject: [PATCH 08/36] Add final edits and complete assignment --- ch_1_assign_sophia_palomares.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ch_1_assign_sophia_palomares.py b/ch_1_assign_sophia_palomares.py index 70bbacf..14b3425 100644 --- a/ch_1_assign_sophia_palomares.py +++ b/ch_1_assign_sophia_palomares.py @@ -367,4 +367,5 @@ def team_info(): "2019 CARVER DIVISION" ] -team_info() \ No newline at end of file +team_info() + From d78af3aef9db85e4466320f429593a5873df54c0 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Sat, 21 Sep 2019 11:25:40 -0700 Subject: [PATCH 09/36] Add main components and final touches --- ch_2_assign_sophia_palomares.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ch_2_assign_sophia_palomares.py b/ch_2_assign_sophia_palomares.py index a24a709..48d675e 100644 --- a/ch_2_assign_sophia_palomares.py +++ b/ch_2_assign_sophia_palomares.py @@ -18,7 +18,8 @@ def main_function(): list_team() main_function() elif(user_question_1 == "Exit"): - break + exit_program() + else: print("Input is unknown. Please input Add Team, Remove Team, List of Teams, Search for Team, or Exit.") main_function() @@ -48,7 +49,6 @@ def add_team(): def search_team(): user_search = int(input("What team do you want to search? ")) - #how do I fix this print("Team Name:") print(teams[user_search]["name"]) print("Programming Language:") @@ -65,4 +65,17 @@ def search_team(): def list_team(): print(teams.keys()) +def exit_program(): + print("You are choosing to exit the program") + user_exit = input("Are you sure you want to leave? ") + if(user_exit == "Yes"): + "You are now leaving the program" + break + elif(user_exit == "No"): + "You chose to stay in the program" + main_function() + else: + "Input is unknown. Please input Yes or No" + exit_program() + main_function() \ No newline at end of file From c6dc0589d67202f724bcecc6a63e56e64c97d557 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Wed, 25 Sep 2019 18:54:00 -0700 Subject: [PATCH 10/36] Add final touches and complete assignment --- ch_2_assign_sophia_palomares.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/ch_2_assign_sophia_palomares.py b/ch_2_assign_sophia_palomares.py index 48d675e..c58744c 100644 --- a/ch_2_assign_sophia_palomares.py +++ b/ch_2_assign_sophia_palomares.py @@ -1,5 +1,4 @@ teams = {} -#make sure this is under 1 function def main_function(): user_question_1 = input("What would you like to do? ") @@ -70,7 +69,6 @@ def exit_program(): user_exit = input("Are you sure you want to leave? ") if(user_exit == "Yes"): "You are now leaving the program" - break elif(user_exit == "No"): "You chose to stay in the program" main_function() From 691a603acad7ea92a0e563715c4c051aedb5337e Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Wed, 25 Sep 2019 20:00:53 -0700 Subject: [PATCH 11/36] Redo chapter 1 assignment --- ch_1_assign_remake_sophia_palomares.py | 64 ++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 ch_1_assign_remake_sophia_palomares.py diff --git a/ch_1_assign_remake_sophia_palomares.py b/ch_1_assign_remake_sophia_palomares.py new file mode 100644 index 0000000..f4cbca0 --- /dev/null +++ b/ch_1_assign_remake_sophia_palomares.py @@ -0,0 +1,64 @@ + +dictionary_1678 = { + "rookie year" : 2005, + "location" : "Davis, California, USA", + "compete in 2019" : True, + "competitions and locations" : "Central Valley Regional: Fresno, Ca, USA; Sacramento Reagional: Sacramento, CA, USA; Aerospace Valley Regional: Lancaster, CA, USA; Carver Division: Houston, TX, USA; Einstein Field: Houston, TX, USA.", + "awards" : "CHAIRMAN'S AWARD, CENTRAL VALLEY REGIONAL WINNER, SACRAMENTO REGIONAL WINNER, AEROSPACE VALLEY REGIONAL WINNER", +} + +dictionary_1682 = { + "rookie year" : 2005, + "location" : "Riverside, California, USA", + "compete in 2019" : False, + "competitions" : "None", + "competitions and locations" : "None", + "awards" : "None" +} + +dictionary_1690 = { + "rookie year" : 2005, + "location" : "Binyamina, HaZafon, Israel", + "competions and locations" : "ISR District Event #1: Haifa, HA 00000, Israel; ISR District Event #4: Tel Aviv-Yafo, TA 00000, Israel; FIRST Israel District Championship: Tel Aviv-Yafo, TA 00000, Israel; Darwin Division: Detroit, MI, USA; Indiana Robotics Invitational: Indianapolis, IN, USA;", + "awards" : "None" +} + +dictionary_1700 = { + "rookie year" : 2005, + "location" : "Palo Alto, California, USA", + "compete in 2019" : True, + "competitions and locations" : "San Francisco Regionals: San Francisco, CA, USA; Utah Regionals: West Valley City, Utah, USA; Turing Devision: Houston, TX, USA", + "awards" : "None" +} + +dictionary_2907 = { + "rookie year" : 2009, + "location" : "Auburn, Washington, USA", + "compete in 2019" : True, + "competitions and locations" : "PNW District Auburn Mountainview Event: Auburn, WA, USA; NW District West Valley Event: Spokane, WA, USA; PNW District Auburn Event: Auburn, WA, USA; Pacific Northwest FIRST District Championship: Tacoma, WA, USA; Roebling Division: Houston, TX, USA; Einstein Field: Houston, TX, USA; Peak Performance: Sea Tac, WA, USA;", + "awards" : "2019 PACIFIC NORTHWEST FIRST DISTRICT CHAMPIONSHIP, 2019 ROEBLING DIVISION", +} + +dictionary_3132 = { + "rookie year" : 2010, + "location" : "Sydney, New South Wales, Australia", + "compete in 2019" : True, + "competitions and locations" : "Southern Cross Regional: Sydney Olympic Park, NSW, Australia; NSouth Pacific Regional: Sydney Olympic Park, NSW, Australia; Carver Division: Houston, TX, USA; Einstein Field: Houston, TX, USA; Duel Down Under: Sydney, New South Wales, Australia;", + "awards" : "2019 SOUTHERN CROSS REGIONAL, 2019 CARVER DIVISION", +} + +teams = { + 1678 : dictionary_1678, + 1682 : dictionary_1682, + 1690 : dictionary_1690, + 1700 : dictionary_1700, + 2907 : dictionary_2907, + 3132 : dictionary_3132, +} + +def team_info(): + question1 = int(input("What team would you like to look up? options: 1678, 1682, 1690, 1700, 2907, 3132")) + question2 = input("What about the team would you like to know? options: rookie year, locations, competitions and locations, awards ") + print(teams[question1][question2]) + +team_info() \ No newline at end of file From 7aaedd0af547375b1576f95e83bdf1688e953b94 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Wed, 25 Sep 2019 20:04:20 -0700 Subject: [PATCH 12/36] Redo Chapter 1 assignment on actual file --- ch_1_assign_sophia_palomares.py | 411 ++++---------------------------- 1 file changed, 52 insertions(+), 359 deletions(-) diff --git a/ch_1_assign_sophia_palomares.py b/ch_1_assign_sophia_palomares.py index 14b3425..f4cbca0 100644 --- a/ch_1_assign_sophia_palomares.py +++ b/ch_1_assign_sophia_palomares.py @@ -1,371 +1,64 @@ -def team_info(): - teams = input("What team would you like to look up? options: 1678, 1682, 1690, 1700, 2907, 3132, or Exit ") - #1678 - if(teams == "1678"): - print("You chose team 1678, or Citrus Circuits") - info_question_1678 = input("Would you like to know about the team? Your options are rookie year, location , and competed in 2019. ") - if(info_question_1678 == "rookie year"): - print(rookie[1678]) - team_info() - elif(info_question_1678 == "location"): - print(location[1678]) - team_info() - elif(info_question_1678 == "competed in 2019"): - if(compete_1678 == True): - print("Yes, this team did compete in 2019") - comp_1678_question = input("Would you like to know the competitions this team competed in?") - if (comp_1678_question == "yes"): - print(competitions_1678) - comp_location_question_1678 = input("Would you like to know where those competitions are located? ") - if(comp_location_question_1678 == "yes"): - print(competitions_locations_1678["1"]) - print(competitions_locations_1678["2"]) - print(competitions_locations_1678["3"]) - print(competitions_locations_1678["4"]) - print(competitions_locations_1678["5"]) - team_info() - else: - print("You chose not to look at where the competitions are located") - team_info() - else: - print("You chose not to look at the competitions") - team_info() - else: - print("Didn't compete in 2019") - team_info() - elif(info_question_1678 == "awards in 2019"): - print(awards_1678) - team_info() - else: - print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, and awards in 2019. Please copy them exactly") - team_info() - #1682 - elif(teams == "1682"): - print("You chose team 1682, or Eye Bots") - info_question_1682 = input("Would you like to know about the team? Your options are rookie year, location , and competed in 2019. ") - if(info_question_1682 == "rookie year"): - print(rookie[1682]) - team_info() - elif(info_question_1682 == "location"): - print(location[1682]) - team_info() - elif(info_question_1682 == "competed in 2019"): - if(compete_1682 == True): - print("Yes, this team did compete in 2019") - comp_1682_question = input("Would you like to know the competitions this team competed in?") - if (comp_1682_question == "yes"): - print(competitions_1682) - comp_location_question_1682 = input("Would you like to know where those competitions are located? ") - if(comp_location_question_1682 == "yes"): - print(competitions_locations_1682["1"]) - team_info() - else: - print("You chose not to look at where the competitions are located") - team_info() - else: - print("You chose not to look at the competitions") - team_info() - else: - print("Didn't compete in 2019") - team_info() - elif(info_question_1682 == "awards in 2019"): - print(awards_1682) - else: - print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, and awards in 2019. Please copy them exactly") - #1690 - elif(teams == "1690"): - print("You chose team 1690, or Orbit") - info_question_1690 = input("Would you like to know about the team? Your options are rookie year, location , and competed in 2019. ") - if(info_question_1690 == "rookie year"): - print(rookie[1690]) - team_info() - elif(info_question_1690 == "location"): - print(location[1690]) - team_info() - elif(info_question_1690 == "competed in 2019"): - if(compete_1690 == True): - print("Yes, this team did compete in 2019") - comp_1690_question = input("Would you like to know the competitions this team competed in?") - if (comp_1690_question == "yes"): - print(competitions_1690) - comp_location_question_1690 = input("Would you like to know where those competitions are located? ") - if(comp_location_question_1690 == "yes"): - print(competitions_locations_1690["1"]) - print(competitions_locations_1690["2"]) - print(competitions_locations_1690["3"]) - print(competitions_locations_1690["4"]) - print(competitions_locations_1690["5"]) - team_info() - else: - print("You chose not to look at where the competitions are located") - team_info() - else: - print("You chose not to look at the competitions") - team_info() - else: - print("Didn't compete in 2019") - team_info() - elif(info_question_1690 == "awards in 2019"): - print(awards_1690) - team_info() - else: - print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, and awards in 2019. Please copy them exactly") - team_info() - #1700 - elif(teams == "1700"): - print("You chose team 1700, or Gatorbotics") - info_question_1700 = input("Would you like to know about the team? Your options are rookie year, location , and competed in 2019. ") - if(info_question_2907 == "rookie year"): - print(rookie[1700]) - team_info() - elif(info_question_1700 == "location"): - print(location[1700]) - team_info() - elif(info_question_1700 == "competed in 2019"): - if(compete_1700 == True): - print("Yes, this team did compete in 2019") - comp_1700_question = input("Would you like to know the competitions this team competed in?") - if (comp_1700_question == "yes"): - print(competitions_1700) - comp_location_question_1700 = input("Would you like to know where those competitions are located? ") - if(comp_location_question_1700 == "yes"): - print(competitions_locations_1700["1"]) - print(competitions_locations_1700["2"]) - print(competitions_locations_1700["3"]) - print(competitions_locations_1700["4"]) - print(competitions_locations_1700["5"]) - print(competitions_locations_1700["6"]) - print(competitions_locations_1700["7"]) - else: - print("You chose not to look at where the competitions are located") - team_info() - else: - print("You chose not to look at the competitions") - team_info() - else: - print("Didn't compete in 2019") - elif(info_question_1700 == "awards in 2019"): - print(awards_1700) - team_info() - else: - print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, and awards in 2019. Please copy them exactly") - team_info() - #2907 - elif(teams == "2907"): - print("You chose team 2907, or Lion Robotics") - info_question_2907 = input("Would you like to know about the team? Your options are rookie year, location , and competed in 2019. ") - if(info_question_2907 == "rookie year"): - print(rookie[2907]) - team_info() - elif(info_question_2907 == "location"): - print(location[2907]) - team_info() - elif(info_question_2907 == "competed in 2019"): - if(compete_2907 == True): - print("Yes, this team did compete in 2019") - comp_2907_question = input("Would you like to know the competitions this team competed in?") - if (comp_2907_question == "yes"): - print(competitions_2907) - comp_location_question_2907 = input("Would you like to know where those competitions are located? ") - if(comp_location_question_2907 == "yes"): - print(competitions_locations_2907["1"]) - print(competitions_locations_2907["2"]) - print(competitions_locations_2907["3"]) - team_info() - else: - print("You chose not to look at where the competitions are located") - team_info() - else: - print("You chose not to look at the competitions") - team_info() - else: - print("Didn't compete in 2019") - team_info() - elif(info_question_2907 == "awards in 2019"): - print(awards_2907) - else: - print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019 and awards in 2019. Please copy them exactly") - #3132 - elif(teams == "3132"): - print("You chose team 3132, or Thunder Down Under") - info_question_3132 = input("Would you like to know about the team? Your options are rookie year, location , and competed in 2019. ") - if(info_question_3132 == "rookie year"): - print(rookie[3132]) - team_info() - elif(info_question_3132 == "location"): - print(location[3132]) - team_info() - elif(info_question_3132 == "competed in 2019"): - if(compete_3132 == True): - print("Yes, this team did compete in 2019") - comp_3132_question = input("Would you like to know the competitions this team competed in? ") - if (comp_3132_question == "yes"): - print(competitions_3132) - comp_location_question_3132 = input("Would you like to know where those competitions are located? ") - if(comp_location_question_3132 == "yes"): - print(competitions_locations_3132["1"]) - print(competitions_locations_3132["2"]) - print(competitions_locations_3132["3"]) - print(competitions_locations_3132["4"]) - print(competitions_locations_3132["5"]) - team_info() - else: - print("You chose not to look at where the competitions are located") - team_info() - else: - print("You chose not to look at the competitions") - team_info() - else: - print("Didn't compete in 2019") - team_info() - elif(info_question_3132 == "awards in 2019"): - print(awards_3132) - team_info() - else: - print("I'm sorry I don't know what you asked. Your options are: rookie year, location, competed in 2019, and awards in 2019. Please copy them exactly") - #End Program - elif(teams == "Exit"): - print("You chose to exit this program") - - else: - print("I'm sorry I don't know what team you asked. You can look up teams 1678, 1682, 1690, 1700, 2907, 3132 or you can enter Exit and leave the program.") - team_info() - -#General Info -team_numbers =[ - 1678, - 1682, - 1690, - 1700, - 2907, - 3132, -]#team numbers -rookie = { - 1678 : 2005, - 1682 : 2005, - 1690 : 2005, - 1700 : 2005, - 2907 : 2009, - 3132 : 2010, -}#teams starting year -location = { - 1678: "Davis, California, USA", - 1682: "Riverside, CA, USA", - 1690: "Binyamina, HaZafon, Israel", - 1700: "Palo Alto, California, USA", - 2907: "Auburn, Washington, USA", - 3132: "Sydney, New South Wales, Australia", -}#team locations -compete_1678 = True -compete_1682 = False -compete_1690 = True -compete_1700 = True -compete_2907 = True -compete_3132 = True - -#1678 -competitions_1678 = [ - "Central Valley Regional", - "Sacramento Reagional", - "Aerospace Valley Regional", - "Carver Division", - "Einstein Field" -] #1678 2019 competitions -competitions_locations_1678 = { - "1" : "Central Valley Regional: Fresno, Ca, USA", - "2": "Sacramento Reagional: Sacramento, CA, USA", - "3": "Aerospace Valley Regional: Lancaster, CA, USA", - "4": "Carver Division: Houston, TX, USA", - "5": "Einstein Field: Houston, TX, USA" -} #1678 2019 competitions and locations -awards_1678 = [ - "CHAIRMAN'S AWARD", - "CENTRAL VALLEY REGIONAL WINNER", - "SACRAMENTO REGIONAL WINNER", - "AEROSPACE VALLEY REGIONAL WINNER" -]#1678 2019 awards - -#1682 -competitions_1682 = [] -competitions_locations_1682 = {} -award_1682 = ["None"] -#1690 -competitions_1690 = [ - "ISR District Event #1", - "ISR District Event #4" - "FIRST Israel District Championship" - "Darwin Division" - "Indiana Robotics Invitational" -] #1690 2019 competitions -competitions_locations_1690 = { - "1" : "ISR District Event #1: Haifa, HA 00000, Israel", - "2" : "ISR District Event #4: Tel Aviv-Yafo, TA 00000, Israel", - "3": "FIRST Israel District Championship: Tel Aviv-Yafo, TA 00000, Israel", - "4": "Darwin Division: Detroit, MI, USA", - "5": "Indiana Robotics Invitational: Indianapolis, IN, USA" -} #1690 2019 competitions and locations -awards_1690 = ["None"] #1690 awards +dictionary_1678 = { + "rookie year" : 2005, + "location" : "Davis, California, USA", + "compete in 2019" : True, + "competitions and locations" : "Central Valley Regional: Fresno, Ca, USA; Sacramento Reagional: Sacramento, CA, USA; Aerospace Valley Regional: Lancaster, CA, USA; Carver Division: Houston, TX, USA; Einstein Field: Houston, TX, USA.", + "awards" : "CHAIRMAN'S AWARD, CENTRAL VALLEY REGIONAL WINNER, SACRAMENTO REGIONAL WINNER, AEROSPACE VALLEY REGIONAL WINNER", +} -#1700 -competitions_1700 = [ - "San Francisco Regionals", - "Utah Regionals", - "Turing Devision" -] -competitions_locations_1700 = { - "1" : "San Francisco Regionals: San Francisco, CA, USA", - "2" : "Utah Regionals: West Valley City, Utah, USA", - "3" : "Turing Devision: Houston, TX, USA" +dictionary_1682 = { + "rookie year" : 2005, + "location" : "Riverside, California, USA", + "compete in 2019" : False, + "competitions" : "None", + "competitions and locations" : "None", + "awards" : "None" +} +dictionary_1690 = { + "rookie year" : 2005, + "location" : "Binyamina, HaZafon, Israel", + "competions and locations" : "ISR District Event #1: Haifa, HA 00000, Israel; ISR District Event #4: Tel Aviv-Yafo, TA 00000, Israel; FIRST Israel District Championship: Tel Aviv-Yafo, TA 00000, Israel; Darwin Division: Detroit, MI, USA; Indiana Robotics Invitational: Indianapolis, IN, USA;", + "awards" : "None" } -award_1700 = ["None"] -#2907 -competitions_2907 = [ - "PNW District Auburn Mountainview Event", - "PNW District West Valley Event", - "PNW District Auburn Event", - "Pacific Northwest FIRST District Championship", - "Roebling Division", - "Einstein Field", - "Peak Performance", +dictionary_1700 = { + "rookie year" : 2005, + "location" : "Palo Alto, California, USA", + "compete in 2019" : True, + "competitions and locations" : "San Francisco Regionals: San Francisco, CA, USA; Utah Regionals: West Valley City, Utah, USA; Turing Devision: Houston, TX, USA", + "awards" : "None" +} +dictionary_2907 = { + "rookie year" : 2009, + "location" : "Auburn, Washington, USA", + "compete in 2019" : True, + "competitions and locations" : "PNW District Auburn Mountainview Event: Auburn, WA, USA; NW District West Valley Event: Spokane, WA, USA; PNW District Auburn Event: Auburn, WA, USA; Pacific Northwest FIRST District Championship: Tacoma, WA, USA; Roebling Division: Houston, TX, USA; Einstein Field: Houston, TX, USA; Peak Performance: Sea Tac, WA, USA;", + "awards" : "2019 PACIFIC NORTHWEST FIRST DISTRICT CHAMPIONSHIP, 2019 ROEBLING DIVISION", +} -] -competitions_locations_2907 = { - "1" : "PNW District Auburn Mountainview Event: Auburn, WA, USA", - "2" : "NW District West Valley Event: Spokane, WA, USA", - "3" : "PNW District Auburn Event: Auburn, WA, USA", - "4" : "Pacific Northwest FIRST District Championship: Tacoma, WA, USA", - "5" : "Roebling Division: Houston, TX, USA", - "6" : "Einstein Field: Houston, TX, USA", - "7" : "Peak Performance: Sea Tac, WA, USA" +dictionary_3132 = { + "rookie year" : 2010, + "location" : "Sydney, New South Wales, Australia", + "compete in 2019" : True, + "competitions and locations" : "Southern Cross Regional: Sydney Olympic Park, NSW, Australia; NSouth Pacific Regional: Sydney Olympic Park, NSW, Australia; Carver Division: Houston, TX, USA; Einstein Field: Houston, TX, USA; Duel Down Under: Sydney, New South Wales, Australia;", + "awards" : "2019 SOUTHERN CROSS REGIONAL, 2019 CARVER DIVISION", } -award_2907 = [ - "2019 PACIFIC NORTHWEST FIRST DISTRICT CHAMPIONSHIP", - "2019 ROEBLING DIVISION" -] -#3132 -competitions_3132 = [ - "Southern Cross Regional", - "South Pacific Regional", - "Carver Division", - "Einstein Field", - "Duel Down Under", -] -competitions_locations_3132 = { - "1" : "Southern Cross Regional: Sydney Olympic Park, NSW, Australia", - "2" : "NSouth Pacific Regional: Sydney Olympic Park, NSW, Australia", - "3" : "Carver Division: Houston, TX, USA", - "4" : "Einstein Field: Houston, TX, USA", - "5" : "Duel Down Under: Sydney, New South Wales, Australia" +teams = { + 1678 : dictionary_1678, + 1682 : dictionary_1682, + 1690 : dictionary_1690, + 1700 : dictionary_1700, + 2907 : dictionary_2907, + 3132 : dictionary_3132, } -award_3132 = [ - "2019 SOUTHERN CROSS REGIONAL", - "2019 CARVER DIVISION" -] -team_info() +def team_info(): + question1 = int(input("What team would you like to look up? options: 1678, 1682, 1690, 1700, 2907, 3132")) + question2 = input("What about the team would you like to know? options: rookie year, locations, competitions and locations, awards ") + print(teams[question1][question2]) +team_info() \ No newline at end of file From 003a779efbb140f090174cbbdd2c0e04ba8b130a Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Wed, 25 Sep 2019 20:36:15 -0700 Subject: [PATCH 13/36] Update search function --- ch_2_assign_sophia_palomares.py | 37 +++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/ch_2_assign_sophia_palomares.py b/ch_2_assign_sophia_palomares.py index c58744c..dbf0942 100644 --- a/ch_2_assign_sophia_palomares.py +++ b/ch_2_assign_sophia_palomares.py @@ -22,6 +22,7 @@ def main_function(): else: print("Input is unknown. Please input Add Team, Remove Team, List of Teams, Search for Team, or Exit.") main_function() + def remove_teams(): key = int(input("What team do you want to remove? ")) teams.pop(key) @@ -43,23 +44,33 @@ def add_team(): temp_team_dictionary["camera vision system"] = cam_vision temp_team_dictionary["drivetrain motors"] = drive_motors - team_number_input = int(input("Add a team number")) + team_number_input = int(input("Add a team number ")) teams[team_number_input] = temp_team_dictionary def search_team(): user_search = int(input("What team do you want to search? ")) - print("Team Name:") - print(teams[user_search]["name"]) - print("Programming Language:") - print(teams[user_search]["programming language"]) - print("Robot's Width:") - print(teams[user_search]["width"]) - print("Robot's Length:") - print(teams[user_search]["length"]) - print("Y/N Camera Vision System:") - print(teams[user_search]["camera vision system"]) - print("Number of Drivetrain Motors:") - print(teams[user_search]["drivetrain motors"]) + user_search_specific = input("What would you like to look up about a team? options: Team Name, Programming Language, Robot Width, Camera Vision System, Drivetrain Motors. ") + if(user_search_specific == "Team Name"): + print("Team Name:") + print(teams[user_search]["name"]) + elif(user_search_specific == "Programming Language"): + print("Programming Language:") + print(teams[user_search]["programming language"]) + elif(user_search_specific == "Robot Width"): + print("Robot's Width:") + print(teams[user_search]["width"]) + elif(user_search_specific == "Robot Length"): + print("Robot's Length:") + print(teams[user_search]["length"]) + elif(user_search_specific == "Camera Vision System"): + print("Y/N Camera Vision System:") + print(teams[user_search]["camera vision system"]) + elif(user_search_specific == "Drivetrain Motors"): + print("Number of Drivetrain Motors:") + print(teams[user_search]["drivetrain motors"]) + else: + print("Unknown Input") + search_team() def list_team(): print(teams.keys()) From 54f6541d5e9d04ef4582fc7a9660197aa8ea8b3c Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Thu, 26 Sep 2019 19:28:56 -0700 Subject: [PATCH 14/36] Update and complete chapter 1 assignment --- ch_1_assign_sophia_palomares.py | 106 ++++++++++++++------------------ 1 file changed, 45 insertions(+), 61 deletions(-) diff --git a/ch_1_assign_sophia_palomares.py b/ch_1_assign_sophia_palomares.py index f4cbca0..1ae5466 100644 --- a/ch_1_assign_sophia_palomares.py +++ b/ch_1_assign_sophia_palomares.py @@ -1,64 +1,48 @@ - -dictionary_1678 = { - "rookie year" : 2005, - "location" : "Davis, California, USA", - "compete in 2019" : True, - "competitions and locations" : "Central Valley Regional: Fresno, Ca, USA; Sacramento Reagional: Sacramento, CA, USA; Aerospace Valley Regional: Lancaster, CA, USA; Carver Division: Houston, TX, USA; Einstein Field: Houston, TX, USA.", - "awards" : "CHAIRMAN'S AWARD, CENTRAL VALLEY REGIONAL WINNER, SACRAMENTO REGIONAL WINNER, AEROSPACE VALLEY REGIONAL WINNER", -} - -dictionary_1682 = { - "rookie year" : 2005, - "location" : "Riverside, California, USA", - "compete in 2019" : False, - "competitions" : "None", - "competitions and locations" : "None", - "awards" : "None" -} - -dictionary_1690 = { - "rookie year" : 2005, - "location" : "Binyamina, HaZafon, Israel", - "competions and locations" : "ISR District Event #1: Haifa, HA 00000, Israel; ISR District Event #4: Tel Aviv-Yafo, TA 00000, Israel; FIRST Israel District Championship: Tel Aviv-Yafo, TA 00000, Israel; Darwin Division: Detroit, MI, USA; Indiana Robotics Invitational: Indianapolis, IN, USA;", - "awards" : "None" -} - -dictionary_1700 = { - "rookie year" : 2005, - "location" : "Palo Alto, California, USA", - "compete in 2019" : True, - "competitions and locations" : "San Francisco Regionals: San Francisco, CA, USA; Utah Regionals: West Valley City, Utah, USA; Turing Devision: Houston, TX, USA", - "awards" : "None" -} - -dictionary_2907 = { - "rookie year" : 2009, - "location" : "Auburn, Washington, USA", - "compete in 2019" : True, - "competitions and locations" : "PNW District Auburn Mountainview Event: Auburn, WA, USA; NW District West Valley Event: Spokane, WA, USA; PNW District Auburn Event: Auburn, WA, USA; Pacific Northwest FIRST District Championship: Tacoma, WA, USA; Roebling Division: Houston, TX, USA; Einstein Field: Houston, TX, USA; Peak Performance: Sea Tac, WA, USA;", - "awards" : "2019 PACIFIC NORTHWEST FIRST DISTRICT CHAMPIONSHIP, 2019 ROEBLING DIVISION", -} - -dictionary_3132 = { - "rookie year" : 2010, - "location" : "Sydney, New South Wales, Australia", - "compete in 2019" : True, - "competitions and locations" : "Southern Cross Regional: Sydney Olympic Park, NSW, Australia; NSouth Pacific Regional: Sydney Olympic Park, NSW, Australia; Carver Division: Houston, TX, USA; Einstein Field: Houston, TX, USA; Duel Down Under: Sydney, New South Wales, Australia;", - "awards" : "2019 SOUTHERN CROSS REGIONAL, 2019 CARVER DIVISION", -} - teams = { - 1678 : dictionary_1678, - 1682 : dictionary_1682, - 1690 : dictionary_1690, - 1700 : dictionary_1700, - 2907 : dictionary_2907, - 3132 : dictionary_3132, + 1678 : { + "rookie year" : 2005, + "location" : "Davis, California, USA", + "compete in 2019" : True, + "competitions and locations" : "Central Valley Regional: Fresno, Ca, USA; Sacramento Reagional: Sacramento, CA, USA; Aerospace Valley Regional: Lancaster, CA, USA; Carver Division: Houston, TX, USA; Einstein Field: Houston, TX, USA.", + "awards" : "CHAIRMAN'S AWARD, CENTRAL VALLEY REGIONAL WINNER, SACRAMENTO REGIONAL WINNER, AEROSPACE VALLEY REGIONAL WINNER", + }, + 1682 : { + "rookie year" : 2005, + "location" : "Riverside, California, USA", + "compete in 2019" : False, + "competitions" : "None", + "competitions and locations" : "None", + "awards" : "None" + }, + 1690 : { + "rookie year" : 2005, + "location" : "Binyamina, HaZafon, Israel", + "compete in 2019" : True, + "competions and locations" : "ISR District Event #1: Haifa, HA 00000, Israel; ISR District Event #4: Tel Aviv-Yafo, TA 00000, Israel; FIRST Israel District Championship: Tel Aviv-Yafo, TA 00000, Israel; Darwin Division: Detroit, MI, USA; Indiana Robotics Invitational: Indianapolis, IN, USA;", + "awards" : "None", + }, + 1700 : { + "rookie year" : 2005, + "location" : "Palo Alto, California, USA", + "compete in 2019" : True, + "competitions and locations" : "San Francisco Regionals: San Francisco, CA, USA; Utah Regionals: West Valley City, Utah, USA; Turing Devision: Houston, TX, USA", + "awards" : "None" + }, + 2907 : { + "rookie year" : 2009, + "location" : "Auburn, Washington, USA", + "compete in 2019" : True, + "competitions and locations" : "PNW District Auburn Mountainview Event: Auburn, WA, USA; NW District West Valley Event: Spokane, WA, USA; PNW District Auburn Event: Auburn, WA, USA; Pacific Northwest FIRST District Championship: Tacoma, WA, USA; Roebling Division: Houston, TX, USA; Einstein Field: Houston, TX, USA; Peak Performance: Sea Tac, WA, USA;", + }, + 3132 : { + "rookie year" : 2010, + "location" : "Sydney, New South Wales, Australia", + "compete in 2019" : True, + "competitions and locations" : "Southern Cross Regional: Sydney Olympic Park, NSW, Australia; NSouth Pacific Regional: Sydney Olympic Park, NSW, Australia; Carver Division: Houston, TX, USA; Einstein Field: Houston, TX, USA; Duel Down Under: Sydney, New South Wales, Australia;", + "awards" : "2019 SOUTHERN CROSS REGIONAL, 2019 CARVER DIVISION", + }, } -def team_info(): - question1 = int(input("What team would you like to look up? options: 1678, 1682, 1690, 1700, 2907, 3132")) - question2 = input("What about the team would you like to know? options: rookie year, locations, competitions and locations, awards ") - print(teams[question1][question2]) - -team_info() \ No newline at end of file +question1 = int(input("What team would you like to look up? options: 1678, 1682, 1690, 1700, 2907, 3132 ")) +question2 = input("What about the team would you like to know? options: rookie year, location, competitions and locations, awards ") +print(teams[question1][question2]) \ No newline at end of file From 4c42c2c554222c3e7ab2032869beb99a2f4a856c Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Sat, 28 Sep 2019 21:23:54 -0700 Subject: [PATCH 15/36] Add all requirements. Finish assignment --- ch_2_assign_sophia_palomares.py | 153 ++++++++++++++++++++++++-------- 1 file changed, 117 insertions(+), 36 deletions(-) diff --git a/ch_2_assign_sophia_palomares.py b/ch_2_assign_sophia_palomares.py index dbf0942..146e3bb 100644 --- a/ch_2_assign_sophia_palomares.py +++ b/ch_2_assign_sophia_palomares.py @@ -1,31 +1,69 @@ teams = {} -def main_function(): - user_question_1 = input("What would you like to do? ") - if(user_question_1 == "Add Team"): - add_team() - main_function() - elif(user_question_1 == "Remove Team"): - print("Please use only the team's number") - remove_teams() - main_function() - elif(user_question_1 == "Search for Team"): - print("Please use only the team's number") - search_team() - main_function() - elif(user_question_1 == "List of Teams"): - list_team() - main_function() - elif(user_question_1 == "Exit"): - exit_program() +#List of Function Operations: +#name_number functions: make team names and number interchangeable for specified functions +#remove_team: removes a team +#modify_team: modifies an attribute for a team +#search_team: searches for an attribute for a team +#add_team: adds a team to the main teams dictionary +#list_team: lists the team #, or keys in the teams dictionary +#exit_program: leaves the program +#main_function: The "main menu" for the other operations - else: - print("Input is unknown. Please input Add Team, Remove Team, List of Teams, Search for Team, or Exit.") - main_function() +def remove_team_name_number(): + user_remove = (input("What team do you want to remove? ")) + for x in teams: + if (teams[x]["name"] == user_remove): + team_name_remove = x + remove_team(team_name_remove) + elif (user_remove.isnumeric()): + if (int(user_remove) == x): + team_name_remove = x + remove_team(team_name_remove) + +def remove_team(team_name_remove): + teams.pop(team_name_remove) + + main_function() + +def modify_team_name_number(): + user_modify = (input("What team do you want to modify? ")) + for x in teams: + if (teams[x]["name"] == user_modify): + team_name_modify = x + modify_team(team_name_modify) + elif (user_modify.isnumeric()): + if (int(user_modify) == x): + team_name_modify = x + modify_team(team_name_modify) -def remove_teams(): - key = int(input("What team do you want to remove? ")) - teams.pop(key) +def modify_team(team_name_modify): + print("Options") + print("Team Name, Programming Language, Robot Width, Robot Length, Camera Vision System, Drivetrain Motors, Team Number") + team_attribute_modify = input("What would you like to modify about the team? ") + if(team_attribute_modify == "Team Name"): + new_name = input("What is the new team name? ") + teams[team_name_modify]["name"] = new_name + elif(team_attribute_modify == "Programming Language"): + new_p_language = input("What is the team's new programming language? ") + teams[team_name_modify]["programming language"] = new_p_language + elif(team_attribute_modify == "Robot Width"): + new_width = input("What is the Robot's updated width? ") + teams[team_name_modify]["width"] = new_width + elif(team_attribute_modify == "Robot Length"): + new_length = input("What is the robot;s updated length?") + teams[team_name_modify]["length"] = new_length + elif(team_attribute_modify == "Camera Vision System"): + new_cam_vis_system = input("Does the team have a camera vision system? ") + teams[team_name_modify]["camera vision system"] = new_cam_vis_system + elif(team_attribute_modify == "Drivetrain Motors"): + new_drive_motors = input("What is the team's updated drivetrain motors? ") + teams[team_name_modify]["drivetrain motors"] = new_drive_motors + elif(team_attribute_modify == "Team Number"): + new_team_number = int(input("What is the team's new team number? ")) + teams[new_team_number] = teams.pop(team_name_modify) + + main_function() def add_team(): temp_team_dictionary = {} @@ -47,44 +85,87 @@ def add_team(): team_number_input = int(input("Add a team number ")) teams[team_number_input] = temp_team_dictionary -def search_team(): - user_search = int(input("What team do you want to search? ")) - user_search_specific = input("What would you like to look up about a team? options: Team Name, Programming Language, Robot Width, Camera Vision System, Drivetrain Motors. ") + main_function() + + +def search_team_name_number(): + user_search = (input("What team do you want to search? ")) + for x in teams: + if (teams[x]["name"] == user_search): + team_name_search = x + search_team(team_name_search) + elif (user_search.isnumeric()): + if (int(user_search) == x): + team_name_search = x + search_team(team_name_search) + +def search_team(team_name_search): + print("Options:") + print("Team Name, Programming Language, Robot Width, Robot Length, Camera Vision System, Drivetrain Motors, Team Number") + user_search_specific = input("What would you like to look up about a team? ") if(user_search_specific == "Team Name"): print("Team Name:") - print(teams[user_search]["name"]) + print(teams[team_name_search]["name"]) elif(user_search_specific == "Programming Language"): print("Programming Language:") - print(teams[user_search]["programming language"]) + print(teams[team_name_search]["programming language"]) elif(user_search_specific == "Robot Width"): print("Robot's Width:") - print(teams[user_search]["width"]) + print(teams[team_name_search]["width"]) elif(user_search_specific == "Robot Length"): print("Robot's Length:") - print(teams[user_search]["length"]) + print(teams[team_name_search]["length"]) elif(user_search_specific == "Camera Vision System"): - print("Y/N Camera Vision System:") - print(teams[user_search]["camera vision system"]) + print("Camera Vision System:") + print(teams[team_name_search]["camera vision system"]) elif(user_search_specific == "Drivetrain Motors"): print("Number of Drivetrain Motors:") - print(teams[user_search]["drivetrain motors"]) + print(teams[team_name_search]["drivetrain motors"]) + elif(user_search_specific == "Team Number"): + print("Team Number:") + print(teams[team_name_search]) else: print("Unknown Input") - search_team() + search_team(team_name_search) + + main_function() def list_team(): print(teams.keys()) + main_function() + def exit_program(): print("You are choosing to exit the program") user_exit = input("Are you sure you want to leave? ") if(user_exit == "Yes"): "You are now leaving the program" + return None elif(user_exit == "No"): "You chose to stay in the program" main_function() else: - "Input is unknown. Please input Yes or No" + print("Input is unknown. Please input Yes or No") + exit_program() + +def main_function(): + print("Options:") + print("Add Team, Remove Team, Modify Team, List of Teams, Search for Team, Exit") + user_question_1 = input("What would you like to do? ") + if(user_question_1 == "Add Team"): + add_team() + elif(user_question_1 == "Modify Team"): + modify_team_name_number() + elif(user_question_1 == "Remove Team"): + remove_team_name_number() + elif(user_question_1 == "Search for Team"): + search_team_name_number() + elif(user_question_1 == "List of Teams"): + list_team() + elif(user_question_1 == "Exit"): exit_program() + else: + print("Input is unknown.") + main_function() main_function() \ No newline at end of file From 242675916ba6129875647193440c154a789970cc Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Wed, 2 Oct 2019 19:25:09 -0700 Subject: [PATCH 16/36] Fix typos --- ch_2_assign_sophia_palomares.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ch_2_assign_sophia_palomares.py b/ch_2_assign_sophia_palomares.py index 146e3bb..7facaee 100644 --- a/ch_2_assign_sophia_palomares.py +++ b/ch_2_assign_sophia_palomares.py @@ -51,7 +51,7 @@ def modify_team(team_name_modify): new_width = input("What is the Robot's updated width? ") teams[team_name_modify]["width"] = new_width elif(team_attribute_modify == "Robot Length"): - new_length = input("What is the robot;s updated length?") + new_length = input("What is the robot's updated length?") teams[team_name_modify]["length"] = new_length elif(team_attribute_modify == "Camera Vision System"): new_cam_vis_system = input("Does the team have a camera vision system? ") @@ -73,7 +73,7 @@ def add_team(): width = int(input("What is your team's robot's width? ")) length = int(input("Wnat is your team's robot's length? ")) cam_vision = input("Does your team's robot's have a camera vision system? ") - drive_motors = int(input("How many dritrain motors does your team have? ")) + drive_motors = int(input("How many drivetrain motors does your team have? ")) temp_team_dictionary["name"] = name temp_team_dictionary["programming language"] = p_language @@ -87,7 +87,6 @@ def add_team(): main_function() - def search_team_name_number(): user_search = (input("What team do you want to search? ")) for x in teams: From f404e22729e1a384a204db544c24f39133cc148e Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Wed, 2 Oct 2019 19:34:16 -0700 Subject: [PATCH 17/36] Fix more Typos --- ch_2_assign_sophia_palomares.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ch_2_assign_sophia_palomares.py b/ch_2_assign_sophia_palomares.py index 7facaee..9ee76b2 100644 --- a/ch_2_assign_sophia_palomares.py +++ b/ch_2_assign_sophia_palomares.py @@ -3,8 +3,8 @@ #List of Function Operations: #name_number functions: make team names and number interchangeable for specified functions #remove_team: removes a team -#modify_team: modifies an attribute for a team -#search_team: searches for an attribute for a team +#modify_team: modifies an attribute of a team +#search_team: searches for an attribute of a team #add_team: adds a team to the main teams dictionary #list_team: lists the team #, or keys in the teams dictionary #exit_program: leaves the program From 195037e09955581bb94595f3520bc4af4a3f6e78 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Wed, 2 Oct 2019 20:34:14 -0700 Subject: [PATCH 18/36] Update search aspect --- ch_2_assign_sophia_palomares.py | 79 +++++++++++++-------------------- 1 file changed, 32 insertions(+), 47 deletions(-) diff --git a/ch_2_assign_sophia_palomares.py b/ch_2_assign_sophia_palomares.py index 9ee76b2..7ed4a19 100644 --- a/ch_2_assign_sophia_palomares.py +++ b/ch_2_assign_sophia_palomares.py @@ -13,11 +13,11 @@ def remove_team_name_number(): user_remove = (input("What team do you want to remove? ")) for x in teams: - if (teams[x]["name"] == user_remove): + if teams[x]["name"] == user_remove: team_name_remove = x remove_team(team_name_remove) - elif (user_remove.isnumeric()): - if (int(user_remove) == x): + elif user_remove.isnumeric(): + if int(user_remove) == x: team_name_remove = x remove_team(team_name_remove) @@ -27,13 +27,13 @@ def remove_team(team_name_remove): main_function() def modify_team_name_number(): - user_modify = (input("What team do you want to modify? ")) + user_modify = input("What team do you want to modify? ") for x in teams: - if (teams[x]["name"] == user_modify): + if teams[x]["name"] == user_modify: team_name_modify = x modify_team(team_name_modify) - elif (user_modify.isnumeric()): - if (int(user_modify) == x): + elif user_modify.isnumeric(): + if int(user_modify) == x: team_name_modify = x modify_team(team_name_modify) @@ -41,25 +41,25 @@ def modify_team(team_name_modify): print("Options") print("Team Name, Programming Language, Robot Width, Robot Length, Camera Vision System, Drivetrain Motors, Team Number") team_attribute_modify = input("What would you like to modify about the team? ") - if(team_attribute_modify == "Team Name"): + if team_attribute_modify == "Team Name": new_name = input("What is the new team name? ") teams[team_name_modify]["name"] = new_name - elif(team_attribute_modify == "Programming Language"): + elif team_attribute_modify == "Programming Language": new_p_language = input("What is the team's new programming language? ") teams[team_name_modify]["programming language"] = new_p_language - elif(team_attribute_modify == "Robot Width"): + elif team_attribute_modify == "Robot Width": new_width = input("What is the Robot's updated width? ") teams[team_name_modify]["width"] = new_width - elif(team_attribute_modify == "Robot Length"): + elif team_attribute_modify == "Robot Length": new_length = input("What is the robot's updated length?") teams[team_name_modify]["length"] = new_length - elif(team_attribute_modify == "Camera Vision System"): + elif team_attribute_modify == "Camera Vision System": new_cam_vis_system = input("Does the team have a camera vision system? ") teams[team_name_modify]["camera vision system"] = new_cam_vis_system - elif(team_attribute_modify == "Drivetrain Motors"): + elif team_attribute_modify == "Drivetrain Motors": new_drive_motors = input("What is the team's updated drivetrain motors? ") teams[team_name_modify]["drivetrain motors"] = new_drive_motors - elif(team_attribute_modify == "Team Number"): + elif team_attribute_modify == "Team Number": new_team_number = int(input("What is the team's new team number? ")) teams[new_team_number] = teams.pop(team_name_modify) @@ -90,39 +90,24 @@ def add_team(): def search_team_name_number(): user_search = (input("What team do you want to search? ")) for x in teams: - if (teams[x]["name"] == user_search): + if teams[x]["name"] == user_search: team_name_search = x search_team(team_name_search) - elif (user_search.isnumeric()): - if (int(user_search) == x): + elif user_search.isnumeric(): + if int(user_search) == x: team_name_search = x search_team(team_name_search) def search_team(team_name_search): + search_aspects = ["name", "programming language", "width", "length", "camera vision system", "drivetrain motors", "team number"] print("Options:") - print("Team Name, Programming Language, Robot Width, Robot Length, Camera Vision System, Drivetrain Motors, Team Number") + print(search_aspects) user_search_specific = input("What would you like to look up about a team? ") - if(user_search_specific == "Team Name"): - print("Team Name:") - print(teams[team_name_search]["name"]) - elif(user_search_specific == "Programming Language"): - print("Programming Language:") - print(teams[team_name_search]["programming language"]) - elif(user_search_specific == "Robot Width"): - print("Robot's Width:") - print(teams[team_name_search]["width"]) - elif(user_search_specific == "Robot Length"): - print("Robot's Length:") - print(teams[team_name_search]["length"]) - elif(user_search_specific == "Camera Vision System"): - print("Camera Vision System:") - print(teams[team_name_search]["camera vision system"]) - elif(user_search_specific == "Drivetrain Motors"): - print("Number of Drivetrain Motors:") - print(teams[team_name_search]["drivetrain motors"]) - elif(user_search_specific == "Team Number"): - print("Team Number:") - print(teams[team_name_search]) + for search_aspect in search_aspects: + if user_search_specific == search_aspect: + print(user_search_specific) + print(teams[team_name_search][user_search_specific]) + break else: print("Unknown Input") search_team(team_name_search) @@ -137,10 +122,10 @@ def list_team(): def exit_program(): print("You are choosing to exit the program") user_exit = input("Are you sure you want to leave? ") - if(user_exit == "Yes"): + if user_exit == "Yes": "You are now leaving the program" return None - elif(user_exit == "No"): + elif user_exit == "No": "You chose to stay in the program" main_function() else: @@ -151,17 +136,17 @@ def main_function(): print("Options:") print("Add Team, Remove Team, Modify Team, List of Teams, Search for Team, Exit") user_question_1 = input("What would you like to do? ") - if(user_question_1 == "Add Team"): + if user_question_1 == "Add Team": add_team() - elif(user_question_1 == "Modify Team"): + elif user_question_1 == "Modify Team": modify_team_name_number() - elif(user_question_1 == "Remove Team"): + elif user_question_1 == "Remove Team": remove_team_name_number() - elif(user_question_1 == "Search for Team"): + elif user_question_1 == "Search for Team": search_team_name_number() - elif(user_question_1 == "List of Teams"): + elif user_question_1 == "List of Teams": list_team() - elif(user_question_1 == "Exit"): + elif user_question_1 == "Exit": exit_program() else: print("Input is unknown.") From b24ce9ab61a9a022bc197507073869e6c0cbb31a Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Wed, 2 Oct 2019 20:48:25 -0700 Subject: [PATCH 19/36] Simplify and make updates to code --- ch_2_assign_sophia_palomares.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/ch_2_assign_sophia_palomares.py b/ch_2_assign_sophia_palomares.py index 7ed4a19..9abda01 100644 --- a/ch_2_assign_sophia_palomares.py +++ b/ch_2_assign_sophia_palomares.py @@ -1,4 +1,5 @@ teams = {} +team_aspects = ["name", "programming language", "width", "length", "camera vision system", "drivetrain motors", "team number"] #List of Function Operations: #name_number functions: make team names and number interchangeable for specified functions @@ -38,9 +39,18 @@ def modify_team_name_number(): modify_team(team_name_modify) def modify_team(team_name_modify): - print("Options") - print("Team Name, Programming Language, Robot Width, Robot Length, Camera Vision System, Drivetrain Motors, Team Number") + print("Options:") + print(team_aspects) team_attribute_modify = input("What would you like to modify about the team? ") + #how do i make this work? will this work? + '''for team_aspect in team_aspects: + if team_attribute_modify == team_aspect: + new_attribute = input("What is the team's updated attribute? ") + teams[team_name_modify][team_aspect] = new_attribute + break + else: + print("Input Unknown") + modify_team(team_name_modify)''' if team_attribute_modify == "Team Name": new_name = input("What is the new team name? ") teams[team_name_modify]["name"] = new_name @@ -99,12 +109,11 @@ def search_team_name_number(): search_team(team_name_search) def search_team(team_name_search): - search_aspects = ["name", "programming language", "width", "length", "camera vision system", "drivetrain motors", "team number"] print("Options:") - print(search_aspects) + print(team_aspects) user_search_specific = input("What would you like to look up about a team? ") - for search_aspect in search_aspects: - if user_search_specific == search_aspect: + for team_aspect in team_aspects: + if user_search_specific == team_aspect: print(user_search_specific) print(teams[team_name_search][user_search_specific]) break From c5d53d713464fbcc01e46e02316f02494bb98ff1 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Thu, 3 Oct 2019 19:04:05 -0700 Subject: [PATCH 20/36] Simplify modify team function --- ch_2_assign_sophia_palomares.py | 84 +++++++++++---------------------- 1 file changed, 28 insertions(+), 56 deletions(-) diff --git a/ch_2_assign_sophia_palomares.py b/ch_2_assign_sophia_palomares.py index 9abda01..3122208 100644 --- a/ch_2_assign_sophia_palomares.py +++ b/ch_2_assign_sophia_palomares.py @@ -12,14 +12,12 @@ #main_function: The "main menu" for the other operations def remove_team_name_number(): - user_remove = (input("What team do you want to remove? ")) - for x in teams: - if teams[x]["name"] == user_remove: - team_name_remove = x + user_remove = input("What team do you want to remove? ") + for team_name_remove in teams: + if teams[team_name_remove]["name"] == user_remove: remove_team(team_name_remove) elif user_remove.isnumeric(): - if int(user_remove) == x: - team_name_remove = x + if int(user_remove) == team_name_remove: remove_team(team_name_remove) def remove_team(team_name_remove): @@ -29,50 +27,26 @@ def remove_team(team_name_remove): def modify_team_name_number(): user_modify = input("What team do you want to modify? ") - for x in teams: - if teams[x]["name"] == user_modify: - team_name_modify = x + for team_name_modify in teams: + if teams[team_name_modify]["name"] == user_modify: modify_team(team_name_modify) elif user_modify.isnumeric(): - if int(user_modify) == x: - team_name_modify = x + if int(user_modify) == team_name_modify: modify_team(team_name_modify) def modify_team(team_name_modify): print("Options:") print(team_aspects) team_attribute_modify = input("What would you like to modify about the team? ") - #how do i make this work? will this work? - '''for team_aspect in team_aspects: + for team_aspect in team_aspects: if team_attribute_modify == team_aspect: new_attribute = input("What is the team's updated attribute? ") teams[team_name_modify][team_aspect] = new_attribute break - else: - print("Input Unknown") - modify_team(team_name_modify)''' - if team_attribute_modify == "Team Name": - new_name = input("What is the new team name? ") - teams[team_name_modify]["name"] = new_name - elif team_attribute_modify == "Programming Language": - new_p_language = input("What is the team's new programming language? ") - teams[team_name_modify]["programming language"] = new_p_language - elif team_attribute_modify == "Robot Width": - new_width = input("What is the Robot's updated width? ") - teams[team_name_modify]["width"] = new_width - elif team_attribute_modify == "Robot Length": - new_length = input("What is the robot's updated length?") - teams[team_name_modify]["length"] = new_length - elif team_attribute_modify == "Camera Vision System": - new_cam_vis_system = input("Does the team have a camera vision system? ") - teams[team_name_modify]["camera vision system"] = new_cam_vis_system - elif team_attribute_modify == "Drivetrain Motors": - new_drive_motors = input("What is the team's updated drivetrain motors? ") - teams[team_name_modify]["drivetrain motors"] = new_drive_motors - elif team_attribute_modify == "Team Number": - new_team_number = int(input("What is the team's new team number? ")) - teams[new_team_number] = teams.pop(team_name_modify) - + else: + print("Input Unknown") + modify_team(team_name_modify) + main_function() def add_team(): @@ -98,14 +72,12 @@ def add_team(): main_function() def search_team_name_number(): - user_search = (input("What team do you want to search? ")) - for x in teams: - if teams[x]["name"] == user_search: - team_name_search = x + user_search = input("What team do you want to search? ") + for team_name_search in teams: + if teams[team_name_search]["name"] == user_search: search_team(team_name_search) elif user_search.isnumeric(): - if int(user_search) == x: - team_name_search = x + if int(user_search) == team_name_search: search_team(team_name_search) def search_team(team_name_search): @@ -130,32 +102,32 @@ def list_team(): def exit_program(): print("You are choosing to exit the program") - user_exit = input("Are you sure you want to leave? ") - if user_exit == "Yes": + user_exit = input("Are you sure you want to leave? (yes/no) ") + if user_exit == "yes": "You are now leaving the program" - return None - elif user_exit == "No": + return + elif user_exit == "no": "You chose to stay in the program" main_function() else: - print("Input is unknown. Please input Yes or No") + print("Input is unknown. Please input yes or no") exit_program() def main_function(): print("Options:") - print("Add Team, Remove Team, Modify Team, List of Teams, Search for Team, Exit") + print("add team, remove team, modify team, list of teams, search for team, exit") user_question_1 = input("What would you like to do? ") - if user_question_1 == "Add Team": + if user_question_1 == "add team": add_team() - elif user_question_1 == "Modify Team": + elif user_question_1 == "modify team": modify_team_name_number() - elif user_question_1 == "Remove Team": + elif user_question_1 == "remove team": remove_team_name_number() - elif user_question_1 == "Search for Team": + elif user_question_1 == "search for team": search_team_name_number() - elif user_question_1 == "List of Teams": + elif user_question_1 == "list of teams": list_team() - elif user_question_1 == "Exit": + elif user_question_1 == "exit": exit_program() else: print("Input is unknown.") From a94f66babbfd0b122d68ddeed3697ad904b585c5 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Thu, 3 Oct 2019 20:43:52 -0700 Subject: [PATCH 21/36] Add add_team() validation --- ch_2_assign_sophia_palomares.py | 50 +++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/ch_2_assign_sophia_palomares.py b/ch_2_assign_sophia_palomares.py index 3122208..5a22b45 100644 --- a/ch_2_assign_sophia_palomares.py +++ b/ch_2_assign_sophia_palomares.py @@ -1,6 +1,7 @@ teams = {} team_aspects = ["name", "programming language", "width", "length", "camera vision system", "drivetrain motors", "team number"] + #List of Function Operations: #name_number functions: make team names and number interchangeable for specified functions #remove_team: removes a team @@ -47,17 +48,29 @@ def modify_team(team_name_modify): print("Input Unknown") modify_team(team_name_modify) + validation_modify_team(team_name_modify) main_function() +def validation_modify_team(team_name_modify): + for digit_answers in team_digit_answers: + if digit_answers[0].isdigit(): + digit_answers = int(digit_answers) + team_name_modify[digit_answer] = digit_answers + else: + print("Input wasn't a number, please enter number") + print(digit_answers) + digit_answer = int(input("Please enter the new answer ")) + team_name_modify[digit_answers] = digit_answer + def add_team(): temp_team_dictionary = {} name = input("What is the name of your team? ") p_language = input("What is your team's programming language? ") - width = int(input("What is your team's robot's width? ")) - length = int(input("Wnat is your team's robot's length? ")) + width = input("What is your team's robot's width? ") + length = input("Wnat is your team's robot's length? ") cam_vision = input("Does your team's robot's have a camera vision system? ") - drive_motors = int(input("How many drivetrain motors does your team have? ")) + drive_motors = input("How many drivetrain motors does your team have? ") temp_team_dictionary["name"] = name temp_team_dictionary["programming language"] = p_language @@ -66,11 +79,30 @@ def add_team(): temp_team_dictionary["camera vision system"] = cam_vision temp_team_dictionary["drivetrain motors"] = drive_motors - team_number_input = int(input("Add a team number ")) - teams[team_number_input] = temp_team_dictionary + team_number_input = input("Add a team number ") + + if team_number_input[0].isdigit(): + team_number_input = int(team_number_input) + teams[team_number_input] = temp_team_dictionary + + else: + print("Input wasn't a number, please enter a team number") + team_number_input = int(input("Add a team number ")) + teams[team_number_input] = temp_team_dictionary + validation_add_team(team_number_input) main_function() +def validation_add_team(team_number_input): + for data_field in ["width", "length", "drivetrain motors"]: + if teams[team_number_input][data_field].isdigit(): + teams[team_number_input][data_field] = int(teams[team_number_input][data_field]) + else: + print("Input wasn't a number, please enter number") + print(data_field) + data_field = int(input("Please enter the new answer ")) + teams[team_number_input][data_field] = data_fields + def search_team_name_number(): user_search = input("What team do you want to search? ") for team_name_search in teams: @@ -102,15 +134,15 @@ def list_team(): def exit_program(): print("You are choosing to exit the program") - user_exit = input("Are you sure you want to leave? (yes/no) ") - if user_exit == "yes": + user_exit = input("Are you sure you want to leave? (y/n) ") + if user_exit == "y": "You are now leaving the program" return - elif user_exit == "no": + elif user_exit == "n": "You chose to stay in the program" main_function() else: - print("Input is unknown. Please input yes or no") + print("Input is unknown. Please input y or n") exit_program() def main_function(): From e30edf0db72b27baf8195f22f343a7e9dd8a115d Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Thu, 3 Oct 2019 20:49:57 -0700 Subject: [PATCH 22/36] Fix validation for add team function --- ch_2_assign_sophia_palomares.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ch_2_assign_sophia_palomares.py b/ch_2_assign_sophia_palomares.py index 5a22b45..522300d 100644 --- a/ch_2_assign_sophia_palomares.py +++ b/ch_2_assign_sophia_palomares.py @@ -50,7 +50,7 @@ def modify_team(team_name_modify): validation_modify_team(team_name_modify) main_function() - +#fix this!!! def validation_modify_team(team_name_modify): for digit_answers in team_digit_answers: if digit_answers[0].isdigit(): @@ -100,8 +100,7 @@ def validation_add_team(team_number_input): else: print("Input wasn't a number, please enter number") print(data_field) - data_field = int(input("Please enter the new answer ")) - teams[team_number_input][data_field] = data_fields + teams[team_number_input][data_field] = int(input("Please enter the new answer ")) def search_team_name_number(): user_search = input("What team do you want to search? ") From bfc1d8ed84cee4a8fb6245c69070b5bc8481a26b Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Thu, 3 Oct 2019 21:59:22 -0700 Subject: [PATCH 23/36] Update validation function to validate str and int inputs --- ch_2_assign_sophia_palomares.py | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/ch_2_assign_sophia_palomares.py b/ch_2_assign_sophia_palomares.py index 522300d..20c3ca7 100644 --- a/ch_2_assign_sophia_palomares.py +++ b/ch_2_assign_sophia_palomares.py @@ -1,7 +1,6 @@ teams = {} team_aspects = ["name", "programming language", "width", "length", "camera vision system", "drivetrain motors", "team number"] - #List of Function Operations: #name_number functions: make team names and number interchangeable for specified functions #remove_team: removes a team @@ -48,19 +47,7 @@ def modify_team(team_name_modify): print("Input Unknown") modify_team(team_name_modify) - validation_modify_team(team_name_modify) main_function() -#fix this!!! -def validation_modify_team(team_name_modify): - for digit_answers in team_digit_answers: - if digit_answers[0].isdigit(): - digit_answers = int(digit_answers) - team_name_modify[digit_answer] = digit_answers - else: - print("Input wasn't a number, please enter number") - print(digit_answers) - digit_answer = int(input("Please enter the new answer ")) - team_name_modify[digit_answers] = digit_answer def add_team(): temp_team_dictionary = {} @@ -90,17 +77,25 @@ def add_team(): team_number_input = int(input("Add a team number ")) teams[team_number_input] = temp_team_dictionary - validation_add_team(team_number_input) + validation(team_number_input) main_function() -def validation_add_team(team_number_input): +def validation(team_number_input): for data_field in ["width", "length", "drivetrain motors"]: if teams[team_number_input][data_field].isdigit(): teams[team_number_input][data_field] = int(teams[team_number_input][data_field]) else: - print("Input wasn't a number, please enter number") + print("Input wasn't a number, please enter number for") print(data_field) teams[team_number_input][data_field] = int(input("Please enter the new answer ")) + for data_field in ["name", "programming language", "camera vision system"]: + if teams[team_number_input][data_field].isdigit() == False: + teams[team_number_input][data_field] = str(teams[team_number_input][data_field]) + else: + print("Input was a number, please enter a word for") + print(data_field) + teams[team_number_input][data_field] = str(input("Please enter the new answer ")) + def search_team_name_number(): user_search = input("What team do you want to search? ") From 03ce91bbe6db7d252bbb77c628a3d7b50ffd8a10 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Thu, 3 Oct 2019 22:02:03 -0700 Subject: [PATCH 24/36] Update comment area --- ch_2_assign_sophia_palomares.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ch_2_assign_sophia_palomares.py b/ch_2_assign_sophia_palomares.py index 20c3ca7..487d665 100644 --- a/ch_2_assign_sophia_palomares.py +++ b/ch_2_assign_sophia_palomares.py @@ -9,6 +9,7 @@ #add_team: adds a team to the main teams dictionary #list_team: lists the team #, or keys in the teams dictionary #exit_program: leaves the program +#validate: validates input for add team function #main_function: The "main menu" for the other operations def remove_team_name_number(): From 2e15ecde9a5e0589c80a10b3d019ebd4165eae32 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Wed, 9 Oct 2019 20:46:12 -0700 Subject: [PATCH 25/36] add main functions --- ch_3_assign_sophia_palomares.py | 243 ++++++++++++++++++++++++++++++++ 1 file changed, 243 insertions(+) create mode 100644 ch_3_assign_sophia_palomares.py diff --git a/ch_3_assign_sophia_palomares.py b/ch_3_assign_sophia_palomares.py new file mode 100644 index 0000000..28b2740 --- /dev/null +++ b/ch_3_assign_sophia_palomares.py @@ -0,0 +1,243 @@ +teams = { + 1678 : { + "rookie year" : 2005, + "location" : "Davis, California, USA", + "compete in 2019" : True, + "competitions and locations" : { + "Central Valley Regional" : "Fresno, Ca, US", + "Sacramento Reagional" : "Sacramento, CA, USA", + "Aerospace Valley Regional" : "Lancaster, CA, USA", + "Carver Division" : "Houston, TX, USA", + "Einstein Field" : "Houston, TX, USA" + }, + "awards" : "CHAIRMAN'S AWARD, CENTRAL VALLEY REGIONAL WINNER, SACRAMENTO REGIONAL WINNER, AEROSPACE VALLEY REGIONAL WINNER", + }, + 1682 : { + "rookie year" : 2005, + "location" : "Riverside, California, USA", + "compete in 2019" : False, + "competitions" : "None", + "competitions and locations" : {}, + "awards" : "None" + }, + 1690 : { + "rookie year" : 2005, + "location" : "Binyamina, HaZafon, Israel", + "compete in 2019" : True, + "competitions and locations" : { + "ISR District Event #1" : "Haifa, HA 00000, Israel", + "ISR District Event #4" : "Tel Aviv-Yafo, TA 00000, Israel", + "FIRST Israel District Championship" : "Tel Aviv-Yafo, TA 00000, Israel", + "Darwin Division": "Detroit, MI, USA", + "Indiana Robotics Invitational" : "Indianapolis, IN, USA;" + }, + "awards" : "None", + }, + 1700 : { + "rookie year" : 2005, + "location" : "Palo Alto, California, USA", + "compete in 2019" : True, + "competitions and locations" : { + "San Francisco Regionals" : "San Francisco, CA, USA", + "Utah Regionals" : "West Valley City, Utah, USA", + "Turing Devision": "Houston, TX, USA" + }, + "awards" : "None" + }, + 2907 : { + "rookie year" : 2009, + "location" : "Auburn, Washington, USA", + "compete in 2019" : True, + "competitions and locations" : { + "PNW District Auburn Mountainview Event" : "Auburn, WA, USA", + "NW District West Valley Event" : "Spokane, WA, USA", + "PNW District Auburn Event" : "Auburn, WA, USA", + "Pacific Northwest FIRST District Championship" : "Tacoma, WA, USA", + "Roebling Division" : "Houston, TX, USA", + "Einstein Field" : "Houston, TX, USA", + "Peak Performance": "Sea Tac, WA, USA;" + }, + "awards" : "None" + }, + 3132 : { + "rookie year" : 2010, + "location" : "Sydney, New South Wales, Australia", + "compete in 2019" : True, + "competitions and locations" : { + "Southern Cross Regional" : "Sydney Olympic Park, NSW, Australia", + "NSouth Pacific Regional" : "Sydney Olympic Park, NSW, Australia", + "Carver Division" : "Houston, TX, USA", + "Einstein Field" : "Houston, TX, USA", + "Duel Down Under" : "Sydney, New South Wales, Australia;" + }, + "awards" : "2019 SOUTHERN CROSS REGIONAL, 2019 CARVER DIVISION", + }, +} + +team_aspects = ["rookie year", "location", "compete in 2019", "competitions and locations", "awards", "team number"] + +#List of Function Operations: +#remove_team: removes a team +#modify_team: modifies an attribute of a team +#search_team: searches for an attribute of a team +#add_team: adds a team to the main teams dictionary +#list_team: lists the team #, or keys in the teams dictionary +#exit_program: leaves the program +#validate: validates input for add team function +#main_function: The "main menu" for the other operations + + +def remove_team(): + user_remove = int(input("What team do you want to remove? ")) + teams.pop(user_remove) + + main_function() + +def modify_team(): + user_modify = int(input("What team do you want to modify? ")) + print("Options:") + print(team_aspects) + team_attribute_modify = input("What would you like to modify about the team? ") + for team_aspect in team_aspects: + if team_attribute_modify == team_aspect: + new_attribute = input("What is the team's updated attribute? ") + teams[user_modify][team_aspect] = new_attribute + break + elif team_attribute_modify == team_aspects[3]: + comp_local() + teams[user_modify]["compete in 2019"] = True + break + elif team_attribute_modify == team_aspects[2]: + new_compete = input("Did the team compete in 2019? (y/n) ") + if new_compete == "y": + teams[user_modify][team_aspect[2]] = True + elif new_compete == "n": + teams[user_modify]["compete in 2019"] = False + teams[user_modify][team_aspects[3]] = "None" + + else: + print("Input Unknown") + modify_team() + + main_function() + +def add_team(): + temp_team_dictionary = {} + + rookie = input("What is the rookie year for your team? ") + location = input("What is your team's location? ") + compete = input("Did your team compete in 2019? (yes/no) ") + if compete == "yes": + compete = True + temp_team_dictionary["competitions and locations"] = comp_local() + elif compete == "no": + compete = False + temp_team_dictionary["competitions and locations"] = ["None, didn't compete"] + awards = input("What award did your team win? ") + + temp_team_dictionary["rookie year"] = rookie + temp_team_dictionary["location"] = location + temp_team_dictionary["compete in 2019"] = compete + temp_team_dictionary["awards"] = awards + + team_number_input = input("Add a team number ") + + if team_number_input[0].isdigit(): + team_number_input = int(team_number_input) + teams[team_number_input] = temp_team_dictionary + + else: + print("Input wasn't a number, please enter a team number") + team_number_input = int(input("Add a team number ")) + teams[team_number_input] = temp_team_dictionary + + validation(team_number_input) + main_function() + +def comp_local(comp_local_dict={}): + comp_local_input = input("Would you like to add a competition and location? (y/n) ") + + while True: + if comp_local_input == "y": + comp = input("What competitions did your team compete in? ") + comp_location = input("Where were those competitions? ") + comp_local_dict[comp] = comp_location + return comp_local(comp_local_dict) + + elif comp_local_input == "n": + return comp_local_dict + + else: + print("Unknown input. Please input y or n") + +def validation(team_number_input): + for data_field in ["rookie year"]: + if teams[team_number_input][data_field].isdigit(): + teams[team_number_input][data_field] = int(teams[team_number_input][data_field]) + else: + print("Input wasn't a number, please enter number for") + print(data_field) + teams[team_number_input][data_field] = int(input("Please enter the new answer ")) + for data_field in ["location", "awards"]: + if teams[team_number_input][data_field].isdigit() == False: + teams[team_number_input][data_field] = str(teams[team_number_input][data_field]) + else: + print("Input was a number, please enter a word for") + print(data_field) + teams[team_number_input][data_field] = str(input("Please enter the new answer ")) + +def search_team(): + user_search = int(input("What team do you want to search? ")) + print("Options:") + print(team_aspects) + user_search_specific = input("What would you like to look up about a team? ") + for team_aspect in team_aspects: + if user_search_specific == team_aspect: + print(user_search_specific) + print(teams[user_search][user_search_specific]) + break + else: + print("Unknown Input") + search_team() + + main_function() + +def list_team(): + print(teams.keys()) + + main_function() + +def exit_program(): + print("You are choosing to exit the program") + user_exit = input("Are you sure you want to leave? (y/n) ") + if user_exit == "y": + "You are now leaving the program" + return + elif user_exit == "n": + "You chose to stay in the program" + main_function() + else: + print("Input is unknown. Please input y or n") + exit_program() + +def main_function(): + print("Options:") + print("add team, remove team, modify team, list of teams, search for team, exit") + user_question_1 = input("What would you like to do? ") + if user_question_1 == "add team": + add_team() + elif user_question_1 == "modify team": + modify_team() + elif user_question_1 == "remove team": + remove_team() + elif user_question_1 == "search for team": + search_team() + elif user_question_1 == "list of teams": + list_team() + elif user_question_1 == "exit": + exit_program() + else: + print("Input is unknown.") + main_function() + +main_function() \ No newline at end of file From f1d6d54ea63b0d26ad7d4f5931242dd10f5e3c52 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Thu, 10 Oct 2019 19:13:33 -0700 Subject: [PATCH 26/36] Update modify team function --- ch_3_assign_sophia_palomares.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/ch_3_assign_sophia_palomares.py b/ch_3_assign_sophia_palomares.py index 28b2740..6e48145 100644 --- a/ch_3_assign_sophia_palomares.py +++ b/ch_3_assign_sophia_palomares.py @@ -81,6 +81,7 @@ #modify_team: modifies an attribute of a team #search_team: searches for an attribute of a team #add_team: adds a team to the main teams dictionary +#comp_local: makes a seperate dictionary for the competitions and locations for a team #list_team: lists the team #, or keys in the teams dictionary #exit_program: leaves the program #validate: validates input for add team function @@ -104,17 +105,28 @@ def modify_team(): teams[user_modify][team_aspect] = new_attribute break elif team_attribute_modify == team_aspects[3]: - comp_local() + teams[user_modify]["competitions and locations"] = comp_local() teams[user_modify]["compete in 2019"] = True break elif team_attribute_modify == team_aspects[2]: new_compete = input("Did the team compete in 2019? (y/n) ") if new_compete == "y": teams[user_modify][team_aspect[2]] = True + comp_local_modify = input("Would you like to add competitions? (y/n) ") + while True: + if comp_local_modify == "y": + teams[user_modify]["competitions and locations"] = comp_local() + break + elif comp_local_modify == "n": + teams[user_modify]["competitions and locations"] = "None" + break + else: + print("Unknown input, please input y or n") + break elif new_compete == "n": teams[user_modify]["compete in 2019"] = False teams[user_modify][team_aspects[3]] = "None" - + break else: print("Input Unknown") modify_team() @@ -159,8 +171,8 @@ def comp_local(comp_local_dict={}): while True: if comp_local_input == "y": - comp = input("What competitions did your team compete in? ") - comp_location = input("Where were those competitions? ") + comp = input("What competition did your team compete in? ") + comp_location = input("Where was that competition? ") comp_local_dict[comp] = comp_location return comp_local(comp_local_dict) From df30446ec4508b5b423fc17243463b9ea7506f8e Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Thu, 10 Oct 2019 19:22:10 -0700 Subject: [PATCH 27/36] Update comment section --- ch_3_assign_sophia_palomares.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ch_3_assign_sophia_palomares.py b/ch_3_assign_sophia_palomares.py index 6e48145..cf3b91d 100644 --- a/ch_3_assign_sophia_palomares.py +++ b/ch_3_assign_sophia_palomares.py @@ -76,16 +76,16 @@ team_aspects = ["rookie year", "location", "compete in 2019", "competitions and locations", "awards", "team number"] -#List of Function Operations: -#remove_team: removes a team -#modify_team: modifies an attribute of a team -#search_team: searches for an attribute of a team -#add_team: adds a team to the main teams dictionary -#comp_local: makes a seperate dictionary for the competitions and locations for a team -#list_team: lists the team #, or keys in the teams dictionary -#exit_program: leaves the program -#validate: validates input for add team function -#main_function: The "main menu" for the other operations +"""List of Function Operations: +remove_team: removes a team +modify_team: modifies an attribute of a team +search_team: searches for an attribute of a team +add_team: adds a team to the main teams dictionary +comp_local: makes a seperate dictionary for the competitions and locations for a team +list_team: lists the team #, or keys in the teams dictionary +exit_program: leaves the program +validate: validates input for add team function +main_function: The "main menu" for the other operations""" def remove_team(): From f7c397812694f0f84a02a2be4294e87b4727af05 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Thu, 10 Oct 2019 19:32:12 -0700 Subject: [PATCH 28/36] Make small changes --- ch_3_assign_sophia_palomares.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ch_3_assign_sophia_palomares.py b/ch_3_assign_sophia_palomares.py index cf3b91d..7136c35 100644 --- a/ch_3_assign_sophia_palomares.py +++ b/ch_3_assign_sophia_palomares.py @@ -87,7 +87,6 @@ validate: validates input for add team function main_function: The "main menu" for the other operations""" - def remove_team(): user_remove = int(input("What team do you want to remove? ")) teams.pop(user_remove) From 6b5121519f00d364e88baa6007fe9755a9d21589 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Sat, 12 Oct 2019 11:29:14 -0700 Subject: [PATCH 29/36] Add validation for when inputing a team --- ch_3_assign_sophia_palomares.py | 59 +++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/ch_3_assign_sophia_palomares.py b/ch_3_assign_sophia_palomares.py index 7136c35..e39d40d 100644 --- a/ch_3_assign_sophia_palomares.py +++ b/ch_3_assign_sophia_palomares.py @@ -88,43 +88,45 @@ main_function: The "main menu" for the other operations""" def remove_team(): - user_remove = int(input("What team do you want to remove? ")) - teams.pop(user_remove) + user_remove = input("What team? ") + user_input = ensure_team(user_remove) + teams.pop(user_input) main_function() def modify_team(): - user_modify = int(input("What team do you want to modify? ")) + user_modify = input("What team do you want to modify? ") + user_input = ensure_team(user_modify) print("Options:") print(team_aspects) team_attribute_modify = input("What would you like to modify about the team? ") for team_aspect in team_aspects: if team_attribute_modify == team_aspect: new_attribute = input("What is the team's updated attribute? ") - teams[user_modify][team_aspect] = new_attribute + teams[user_input][team_aspect] = new_attribute break elif team_attribute_modify == team_aspects[3]: - teams[user_modify]["competitions and locations"] = comp_local() - teams[user_modify]["compete in 2019"] = True + teams[user_input]["competitions and locations"] = comp_local() + teams[user_input]["compete in 2019"] = True break elif team_attribute_modify == team_aspects[2]: new_compete = input("Did the team compete in 2019? (y/n) ") if new_compete == "y": - teams[user_modify][team_aspect[2]] = True + teams[user_input][team_aspect[2]] = True comp_local_modify = input("Would you like to add competitions? (y/n) ") while True: if comp_local_modify == "y": - teams[user_modify]["competitions and locations"] = comp_local() + teams[user_input]["competitions and locations"] = comp_local() break elif comp_local_modify == "n": - teams[user_modify]["competitions and locations"] = "None" + teams[user_input]["competitions and locations"] = "None" break else: print("Unknown input, please input y or n") break elif new_compete == "n": - teams[user_modify]["compete in 2019"] = False - teams[user_modify][team_aspects[3]] = "None" + teams[user_input]["compete in 2019"] = False + teams[user_input][team_aspects[3]] = "None" break else: print("Input Unknown") @@ -167,17 +169,14 @@ def add_team(): def comp_local(comp_local_dict={}): comp_local_input = input("Would you like to add a competition and location? (y/n) ") - while True: if comp_local_input == "y": comp = input("What competition did your team compete in? ") comp_location = input("Where was that competition? ") comp_local_dict[comp] = comp_location return comp_local(comp_local_dict) - elif comp_local_input == "n": - return comp_local_dict - + return comp_local_dict else: print("Unknown input. Please input y or n") @@ -198,14 +197,15 @@ def validation(team_number_input): teams[team_number_input][data_field] = str(input("Please enter the new answer ")) def search_team(): - user_search = int(input("What team do you want to search? ")) + user_search = input("What team? ") + user_input = ensure_team(user_search) print("Options:") print(team_aspects) user_search_specific = input("What would you like to look up about a team? ") for team_aspect in team_aspects: if user_search_specific == team_aspect: print(user_search_specific) - print(teams[user_search][user_search_specific]) + print(teams[user_input][user_search_specific]) break else: print("Unknown Input") @@ -213,6 +213,31 @@ def search_team(): main_function() +def ensure_team(user_input): + if user_input.isdigit(): + user_input = int(user_input) + for team in teams.keys(): + if user_input == team: + return user_input + else: + print("Input wasn't a team number, please enter a team number") + print("Options") + print(teams.keys()) + user_input = int(input("Enter team number ")) + return user_input + elif user_input.isdigit() == False: + print("Input wasn't a number, please enter a number") + user_input = int(input("Enter team number ")) + for team in teams.keys(): + if user_input == team: + return user_input + else: + print("Input wasn't a team number, please enter a team number") + print("Options") + print(teams.keys()) + user_input = int(input("Enter team number ")) + return user_input + def list_team(): print(teams.keys()) From 42f44da03c737a1208dfe706e5da61174da8b4af Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Sun, 13 Oct 2019 12:34:18 -0700 Subject: [PATCH 30/36] Update comment section --- ch_3_assign_sophia_palomares.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ch_3_assign_sophia_palomares.py b/ch_3_assign_sophia_palomares.py index e39d40d..11e34c4 100644 --- a/ch_3_assign_sophia_palomares.py +++ b/ch_3_assign_sophia_palomares.py @@ -84,6 +84,7 @@ comp_local: makes a seperate dictionary for the competitions and locations for a team list_team: lists the team #, or keys in the teams dictionary exit_program: leaves the program +ensure_team: ensures all team inputs are actual teams in the dictionary validate: validates input for add team function main_function: The "main menu" for the other operations""" From 276fb235f7d725f040bb77feba459fe0c80a899d Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Wed, 23 Oct 2019 20:35:36 -0700 Subject: [PATCH 31/36] Complete assignment --- ch_4_sophia_palomares.py | 64 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 ch_4_sophia_palomares.py diff --git a/ch_4_sophia_palomares.py b/ch_4_sophia_palomares.py new file mode 100644 index 0000000..b861204 --- /dev/null +++ b/ch_4_sophia_palomares.py @@ -0,0 +1,64 @@ +from math import sqrt + +class Point: + def __init__(self, x, y): + self.x = x + self.y = y + + def distance(self): + self.distance_solve = sqrt(self.x**2 + self.y**2) + return self.distance_solve + +class Point3D(Point): + def __init__(self, x, y, z): + super().__init__(x, y) + self.z = z + + def distance(self): + self.distance_3D_solve = sqrt(super().distance()**2 + self.z**2) + return self.distance_3D_solve + +def distance_maker(): + print("you are finding the hypotonuse of a 2D triangle") + x_input = input("What is the x value? ") + x_input = validation(x_input) + y_input = input("what is the y value? ") + y_input = validation(y_input) + hyp = Point(x_input, y_input) + return hyp + +def distance_maker_3D(): + print("you are finding the hypotonuse of a 3D triangle") + x_input = input("What is the x value? ") + x_input = validation(x_input) + y_input = input("what is the y value? ") + y_input = validation(y_input) + z_input = input("What is the z value? ") + z_input = validation(z_input) + hyp_3D = Point3D(x_input, y_input, z_input) + return hyp_3D + +def checker(): + p1 = distance_maker() + print("This is the hypotenuse for the 2D triangle") + print(p1.distance()) + p2 = distance_maker_3D() + print("This is the hypotenuse for the 3D triangle") + print(p2.distance()) + if p1.distance() > p2.distance(): + print("2D-hypotenuse is bigger") + elif p1 == p2: + print("The hypotenuses are equal") + else: + print("3D-hypotenuse is bigger") + +def validation(user_input): + if user_input.isdigit(): + user_input = int(user_input) + return user_input + else: + print("Input wasn't a number, please enter a number.") + user_new_input = input("Please enter a value: ") + validation(user_new_input) + +checker() \ No newline at end of file From 54e80562a8a7e2166f20fa0811cb2a1894413578 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Sun, 27 Oct 2019 11:23:49 -0700 Subject: [PATCH 32/36] make division checker --- div_checker.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 div_checker.py diff --git a/div_checker.py b/div_checker.py new file mode 100644 index 0000000..7352248 --- /dev/null +++ b/div_checker.py @@ -0,0 +1,19 @@ +def div_checker(): + input1 = int(input("What is the first #? ")) + input2 = int(input("What is the second #? ")) + answer1 = input1 / input2 + answer2 = input2 / input1 + for answer in [answer1, answer2]: + if isinstance(answer,float): + answer_int = int(answer) + answer_check = answer - answer_int + if answer_check == 0.0: + print("Yes they are divisable") + print(answer) + break + else: + break + else: + print("No they aren't divisable") + +div_checker() \ No newline at end of file From 39a670375a27ddd752e394ff39517ac33546daad Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Wed, 30 Oct 2019 19:35:50 -0700 Subject: [PATCH 33/36] Fixed validation function --- ch_2_assign_sophia_palomares.py | 65 +++++++++++++++++++++------------ ch_4_assign_sophia_palomares.py | 63 ++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 24 deletions(-) create mode 100644 ch_4_assign_sophia_palomares.py diff --git a/ch_2_assign_sophia_palomares.py b/ch_2_assign_sophia_palomares.py index 487d665..94da108 100644 --- a/ch_2_assign_sophia_palomares.py +++ b/ch_2_assign_sophia_palomares.py @@ -1,5 +1,7 @@ teams = {} team_aspects = ["name", "programming language", "width", "length", "camera vision system", "drivetrain motors", "team number"] +number_aspects = ["width", "length", "drivetrain motors"] +word_aspects = ["name", "programming language", "camera vision system"] #List of Function Operations: #name_number functions: make team names and number interchangeable for specified functions @@ -9,7 +11,7 @@ #add_team: adds a team to the main teams dictionary #list_team: lists the team #, or keys in the teams dictionary #exit_program: leaves the program -#validate: validates input for add team function +#validation: validates input for add team function #main_function: The "main menu" for the other operations def remove_team_name_number(): @@ -42,6 +44,14 @@ def modify_team(team_name_modify): for team_aspect in team_aspects: if team_attribute_modify == team_aspect: new_attribute = input("What is the team's updated attribute? ") + for attribute in number_aspects: + if team_attribute_modify == attribute: + new_attribute = validation_number(new_attribute) + break + for attribute in word_aspects: + if team_attribute_modify == attribute: + new_attribute = validation_word(new_attribute) + break teams[team_name_modify][team_aspect] = new_attribute break else: @@ -54,18 +64,24 @@ def add_team(): temp_team_dictionary = {} name = input("What is the name of your team? ") + val_name = validation_word(name) p_language = input("What is your team's programming language? ") + val_p_language = validation_word(p_language) width = input("What is your team's robot's width? ") + val_width = validation_number(width) length = input("Wnat is your team's robot's length? ") + val_length = validation_number(length) cam_vision = input("Does your team's robot's have a camera vision system? ") + val_cam_vision = validation_word(cam_vision) drive_motors = input("How many drivetrain motors does your team have? ") + val_drive_motors = validation_number(drive_motors) - temp_team_dictionary["name"] = name - temp_team_dictionary["programming language"] = p_language - temp_team_dictionary["width"] = width - temp_team_dictionary["length"] = length - temp_team_dictionary["camera vision system"] = cam_vision - temp_team_dictionary["drivetrain motors"] = drive_motors + temp_team_dictionary["name"] = val_name + temp_team_dictionary["programming language"] = val_p_language + temp_team_dictionary["width"] = val_width + temp_team_dictionary["length"] = val_length + temp_team_dictionary["camera vision system"] = val_cam_vision + temp_team_dictionary["drivetrain motors"] = val_drive_motors team_number_input = input("Add a team number ") @@ -78,25 +94,26 @@ def add_team(): team_number_input = int(input("Add a team number ")) teams[team_number_input] = temp_team_dictionary - validation(team_number_input) main_function() -def validation(team_number_input): - for data_field in ["width", "length", "drivetrain motors"]: - if teams[team_number_input][data_field].isdigit(): - teams[team_number_input][data_field] = int(teams[team_number_input][data_field]) - else: - print("Input wasn't a number, please enter number for") - print(data_field) - teams[team_number_input][data_field] = int(input("Please enter the new answer ")) - for data_field in ["name", "programming language", "camera vision system"]: - if teams[team_number_input][data_field].isdigit() == False: - teams[team_number_input][data_field] = str(teams[team_number_input][data_field]) - else: - print("Input was a number, please enter a word for") - print(data_field) - teams[team_number_input][data_field] = str(input("Please enter the new answer ")) - +def validation_number(user_input): + if user_input.isdigit(): + user_input = int(user_input) + return user_input + else: + print("User input wasn't a number, please enter a number.") + user_new_input = input("Please enter new answer: ") + validation_number(user_new_input) + return user_new_input + +def validation_word(user_input): + if user_input.isdigit() == False: + return user_input + else: + print("User input wasn't a word, please enter a word") + user_new_input = input("Please enter new answer: ") + validation_word(user_new_input) + return user_new_input def search_team_name_number(): user_search = input("What team do you want to search? ") diff --git a/ch_4_assign_sophia_palomares.py b/ch_4_assign_sophia_palomares.py new file mode 100644 index 0000000..51e48a1 --- /dev/null +++ b/ch_4_assign_sophia_palomares.py @@ -0,0 +1,63 @@ +from math import sqrt + +class Point: + def __init__(self, x, y): + self.x = x + self.y = y + + def distance(self): + self.distance_solve = sqrt(self.x**2 + self.y**2) + return self.distance_solve + +class Point3D(Point): + def __init__(self, x, y, z): + super().__init__(x, y) + self.z = z + + def distance(self): + self.distance_3D_solve = sqrt(super().distance()**2 + self.z**2) + return self.distance_3D_solve + +def distance_maker(): + print("you are finding the hypotonuse of a 2D triangle") + x_input = input("What is the x value? ") + x_input = validation(x_input) + y_input = input("what is the y value? ") + y_input = validation(y_input) + hyp = Point(x_input, y_input) + return hyp + +def distance_maker_3D(): + print("you are finding the hypotonuse of a 3D triangle") + x_input = input("What is the x value? ") + x_input = validation(x_input) + y_input = input("what is the y value? ") + y_input = validation(y_input) + z_input = input("What is the z value? ") + z_input = validation(z_input) + hyp_3D = Point3D(x_input, y_input, z_input) + return hyp_3D + +def checker(): + p1 = distance_maker() + print("This is the hypotenuse for the 2D triangle") + print(p1.distance()) + p2 = distance_maker_3D() + print("This is the hypotenuse for the 3D triangle") + print(p2.distance()) + if p1.distance() > p2.distance(): + print("2D-hypotenuse is bigger") + elif p1 == p2: + print("The hypotenuses are equal") + else: + print("3D-hypotenuse is bigger") +def validation(user_input): + if user_input.isdigit(): + user_input = int(user_input) + return user_input + else: + print("Input wasn't a number, please enter a number.") + user_new_input = input("Please enter a value: ") + validation(user_new_input) + +checker() \ No newline at end of file From a5472c8002b92195172f116824c04b3041792648 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Wed, 30 Oct 2019 19:37:20 -0700 Subject: [PATCH 34/36] Recommit assignment --- ch_1_assign_sophia_palomares.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ch_1_assign_sophia_palomares.py b/ch_1_assign_sophia_palomares.py index 1ae5466..0f5e678 100644 --- a/ch_1_assign_sophia_palomares.py +++ b/ch_1_assign_sophia_palomares.py @@ -43,6 +43,9 @@ }, } -question1 = int(input("What team would you like to look up? options: 1678, 1682, 1690, 1700, 2907, 3132 ")) -question2 = input("What about the team would you like to know? options: rookie year, location, competitions and locations, awards ") -print(teams[question1][question2]) \ No newline at end of file +def look_team(): + question1 = int(input("What team would you like to look up? options: 1678, 1682, 1690, 1700, 2907, 3132 ")) + question2 = input("What about the team would you like to know? options: rookie year, location, competitions and locations, awards ") + print(teams[question1][question2]) + +look_team() \ No newline at end of file From 6053b006ca0d4582ae426de04fc27899e587d0f8 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Sat, 2 Nov 2019 10:50:39 -0700 Subject: [PATCH 35/36] Fixed validation --- ch_4_assign_sophia_palomares.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/ch_4_assign_sophia_palomares.py b/ch_4_assign_sophia_palomares.py index 51e48a1..70aba19 100644 --- a/ch_4_assign_sophia_palomares.py +++ b/ch_4_assign_sophia_palomares.py @@ -51,13 +51,22 @@ def checker(): print("The hypotenuses are equal") else: print("3D-hypotenuse is bigger") + def validation(user_input): if user_input.isdigit(): - user_input = int(user_input) - return user_input + int_user_input = int(user_input) + return int_user_input else: - print("Input wasn't a number, please enter a number.") - user_new_input = input("Please enter a value: ") - validation(user_new_input) + print("User input wasn't a number, please enter a number.") + user_new_input = input("Please enter new answer: ") + try: + user_new_input = int(user_new_input) + return user_new_input + except ValueError: + validation(user_new_input) + return user_new_input + except TypeError: + validation(user_new_input) + return user_new_input checker() \ No newline at end of file From 1b6fab79ee53bff91e0dcd128bd0113cdbf12374 Mon Sep 17 00:00:00 2001 From: Sophia Palomares Date: Wed, 6 Nov 2019 19:01:33 -0800 Subject: [PATCH 36/36] Made sure when the hyp are equal, it shows that they are equal --- ch_4_assign_sophia_palomares.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch_4_assign_sophia_palomares.py b/ch_4_assign_sophia_palomares.py index 70aba19..54b4952 100644 --- a/ch_4_assign_sophia_palomares.py +++ b/ch_4_assign_sophia_palomares.py @@ -47,7 +47,7 @@ def checker(): print(p2.distance()) if p1.distance() > p2.distance(): print("2D-hypotenuse is bigger") - elif p1 == p2: + elif p1.distance() == p2.distance(): print("The hypotenuses are equal") else: print("3D-hypotenuse is bigger")