From def0131da9d75e85e93954f212a098c6f6a52517 Mon Sep 17 00:00:00 2001 From: jonathanhoNumberXIII Date: Wed, 11 Sep 2019 19:42:32 -0700 Subject: [PATCH 01/17] Add Hello World File --- ch_1_Lesson_Jonathan_Ho_Welcome_Back.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 ch_1_Lesson_Jonathan_Ho_Welcome_Back.py diff --git a/ch_1_Lesson_Jonathan_Ho_Welcome_Back.py b/ch_1_Lesson_Jonathan_Ho_Welcome_Back.py new file mode 100644 index 0000000..deb306e --- /dev/null +++ b/ch_1_Lesson_Jonathan_Ho_Welcome_Back.py @@ -0,0 +1 @@ +print("Hello, World... again XD") \ No newline at end of file From 35eb31643b85b0a8e9306988f9d6c3ab98adfa2c Mon Sep 17 00:00:00 2001 From: jonathanhoNumberXIII Date: Wed, 18 Sep 2019 19:34:29 -0700 Subject: [PATCH 02/17] I used the nests to store all of the data separately for each team, then I printed it after placing their team number into the input variable --- ch_1_assign_Jonathan_Ho.py | 67 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 ch_1_assign_Jonathan_Ho.py diff --git a/ch_1_assign_Jonathan_Ho.py b/ch_1_assign_Jonathan_Ho.py new file mode 100644 index 0000000..cdea438 --- /dev/null +++ b/ch_1_assign_Jonathan_Ho.py @@ -0,0 +1,67 @@ +Robot_Team = input("What Robotics Team do you want to look into?") +""" +Robot_Location = +Robot_Debut +Robot_2019 +Robot_comp_names +Robot_comp_locate +Robot_comp_award +""" + +team_1678 = {'Location': {'Show location': 'Davis, CA, USA'}, 'Rookie': {'Rookie Year': '2005'}, 'Season 2019': {'Participate?': 'True'}, + 'Competition Names': ['Central Valley Regional', 'Sacramento Regional', 'Aerospace Valley Regional', 'Carver Division', 'Einstein Field', 'RCC Qianjiang International Robotics Invitational'], + 'Competition Location': ['Fresno, CA, USA', 'Davis, CA, USA', 'Lancaster, CA, USA', 'Houston, TX, USA', 'Houston TX, USA', 'Hangzhou, Zhejiang, China'], + 'Awards': ['Regional Chairman`s Award and Regional Winners', 'FIRST Dean`s List Finalist Award (Katie Stachowicz), Regional Winners, and Industrial Design Award sponsored by General Motors', + 'Regional Winners and Excellence in Engineering Award sponsored by Delphi', 'Championship Subdivision Winner and Entrepreneurship Award sponsored by Kleiner Perkins Caufield and Byers',]} + +team_1111 = {'Location': {'Show location': 'Edgewater, Maryland, USA'}, 'Rookie': {'Rookie Year': '2003'}, 'Season 2019': {'Participate?': 'True'}, + 'Competition Names': ['CHS District Bethesda MD Event sponsored by Bechtel', 'CHS District Owings Mills MD Event sponsored by Leidos', 'FIRST Chesapeake District Championship'], + 'Competition Location': ['Bethesda, MD 20817, USA', 'Owings Mills, MD 21117, USA', 'Fairfax, VA 22030, USA'], + 'Awards': ['Autonomous Award sponsored by Ford', 'District Chairman`s Award', 'Team Spirit Award sponsored by FCA Foundation']} + +team_2222 = {'Location': {'Show location': 'Tacoma, WA, USA'}, 'Rookie': {'Rookie Year': '2007'}, 'Season 2019': {'Participate?': 'False'}, + 'Competition Names': {'Competition': 'Pacific Northwest Regional 2007'}, 'Competition Location': {'Location of Competition': 'Pioneer Courthouse Square in Portland, OR, USA'}, + 'Awards': {'Award': 'None'}} + +team_3333 = {'Location': {'Show location': 'Julesburg, CO, USA'}, 'Rookie': {'Rookie Year': '2010'}, 'Season_2019': {'Participate?': 'False'}, + 'Competition Names': {'Competition': 'Colorado Regional 2010'}, 'Competition Location': {'Location of Competition': 'Ritchie Center in Denver, CO, USA'}, + 'Awards': {'Award': 'Judges Award'}} + +team_5555 = {'Location': {'Show Location': 'Warren, Michigan'}, 'Rookie': {'Rookie Year': '2015'}, 'Season 2019': {'Participate?': 'True'}, + 'Competition Names': ['FIM District Center Line Event','FIM District Marysville Event'], 'Competition Location': ['Center Line, MI, USA', 'Marysville, MI, USA'], + 'Awards': {'Award': 'District Event Winner'}} + + +print(Robot_Team) +if Robot_Team == "1678": + print("Here's their profile!") + print(team_1678) + +elif Robot_Team == "1111": + print("Here's their profile!") + print(team_1111) + +elif Robot_Team == "2222": + print("Here's their profile!") + print(team_2222) + + +elif Robot_Team == "3333": + print("Here's their profile!") + print(team_3333) + +elif Robot_Team == "5555": + print("Here's their profile!") + print(team_5555) + +else: + print("Sorry! I didn't get that!") + + +""" +team_1678_location = {'Show location': 'Davis'} +team_1678_rookie_year = +team_1678_season_par = +team_1678_comp_names = + +""" \ No newline at end of file From 457a616eeedb0cfe7bb8de317b72d6a77df68c46 Mon Sep 17 00:00:00 2001 From: jonathanhoNumberXIII Date: Wed, 18 Sep 2019 19:55:56 -0700 Subject: [PATCH 03/17] I placed the data of each robotics team into nests of dictionaries and printed them out through the input variable. --- ch_1_assign_Jonathan_Ho.py | 130 ++++++++++++++++++++++++++++++------- 1 file changed, 108 insertions(+), 22 deletions(-) diff --git a/ch_1_assign_Jonathan_Ho.py b/ch_1_assign_Jonathan_Ho.py index cdea438..2957351 100644 --- a/ch_1_assign_Jonathan_Ho.py +++ b/ch_1_assign_Jonathan_Ho.py @@ -8,28 +8,114 @@ Robot_comp_award """ -team_1678 = {'Location': {'Show location': 'Davis, CA, USA'}, 'Rookie': {'Rookie Year': '2005'}, 'Season 2019': {'Participate?': 'True'}, - 'Competition Names': ['Central Valley Regional', 'Sacramento Regional', 'Aerospace Valley Regional', 'Carver Division', 'Einstein Field', 'RCC Qianjiang International Robotics Invitational'], - 'Competition Location': ['Fresno, CA, USA', 'Davis, CA, USA', 'Lancaster, CA, USA', 'Houston, TX, USA', 'Houston TX, USA', 'Hangzhou, Zhejiang, China'], - 'Awards': ['Regional Chairman`s Award and Regional Winners', 'FIRST Dean`s List Finalist Award (Katie Stachowicz), Regional Winners, and Industrial Design Award sponsored by General Motors', - 'Regional Winners and Excellence in Engineering Award sponsored by Delphi', 'Championship Subdivision Winner and Entrepreneurship Award sponsored by Kleiner Perkins Caufield and Byers',]} - -team_1111 = {'Location': {'Show location': 'Edgewater, Maryland, USA'}, 'Rookie': {'Rookie Year': '2003'}, 'Season 2019': {'Participate?': 'True'}, - 'Competition Names': ['CHS District Bethesda MD Event sponsored by Bechtel', 'CHS District Owings Mills MD Event sponsored by Leidos', 'FIRST Chesapeake District Championship'], - 'Competition Location': ['Bethesda, MD 20817, USA', 'Owings Mills, MD 21117, USA', 'Fairfax, VA 22030, USA'], - 'Awards': ['Autonomous Award sponsored by Ford', 'District Chairman`s Award', 'Team Spirit Award sponsored by FCA Foundation']} - -team_2222 = {'Location': {'Show location': 'Tacoma, WA, USA'}, 'Rookie': {'Rookie Year': '2007'}, 'Season 2019': {'Participate?': 'False'}, - 'Competition Names': {'Competition': 'Pacific Northwest Regional 2007'}, 'Competition Location': {'Location of Competition': 'Pioneer Courthouse Square in Portland, OR, USA'}, - 'Awards': {'Award': 'None'}} - -team_3333 = {'Location': {'Show location': 'Julesburg, CO, USA'}, 'Rookie': {'Rookie Year': '2010'}, 'Season_2019': {'Participate?': 'False'}, - 'Competition Names': {'Competition': 'Colorado Regional 2010'}, 'Competition Location': {'Location of Competition': 'Ritchie Center in Denver, CO, USA'}, - 'Awards': {'Award': 'Judges Award'}} - -team_5555 = {'Location': {'Show Location': 'Warren, Michigan'}, 'Rookie': {'Rookie Year': '2015'}, 'Season 2019': {'Participate?': 'True'}, - 'Competition Names': ['FIM District Center Line Event','FIM District Marysville Event'], 'Competition Location': ['Center Line, MI, USA', 'Marysville, MI, USA'], - 'Awards': {'Award': 'District Event Winner'}} +team_1678 = { + 'Location': { + 'Show location': 'Davis, CA, USA' + }, 'Rookie': { + 'Rookie Year': '2005' + }, 'Season 2019': { + 'Participate?': 'True' + }, + 'Competition Names': [ + 'Central Valley Regional', + 'Sacramento Regional', + 'Aerospace Valley Regional', + 'Carver Division', + 'Einstein Field', + 'RCC Qianjiang International Robotics Invitational' + ], + 'Competition Location': [ + 'Fresno, CA, USA', + 'Davis, CA, USA', + 'Lancaster, CA, USA', + 'Houston, TX, USA', + 'Houston TX, USA', + 'Hangzhou, Zhejiang, China' + ], + 'Awards': [ + 'Regional Chairman`s Award and Regional Winners', + 'FIRST Dean`s List Finalist Award (Katie Stachowicz), Regional Winners, and Industrial Design Award sponsored by General Motors', + 'Regional Winners and Excellence in Engineering Award sponsored by Delphi', 'Championship Subdivision Winner and Entrepreneurship Award sponsored by Kleiner Perkins Caufield and Byers' + ,] + } + +team_1111 = { + 'Location': { + 'Show location': 'Edgewater, Maryland, USA' + }, 'Rookie': { + 'Rookie Year': '2003' + }, 'Season 2019': { + 'Participate?': 'True' + }, + 'Competition Names': [ + 'CHS District Bethesda MD Event sponsored by Bechtel', + 'CHS District Owings Mills MD Event sponsored by Leidos', + 'FIRST Chesapeake District Championship' + ], + 'Competition Location': [ + 'Bethesda, MD 20817, USA', + 'Owings Mills, MD 21117, USA', + 'Fairfax, VA 22030, USA' + ], + 'Awards': [ + 'Autonomous Award sponsored by Ford', + 'District Chairman`s Award', + 'Team Spirit Award sponsored by FCA Foundation' + ] + } + +team_2222 = { + 'Location': { + 'Show location': 'Tacoma, WA, USA' + }, 'Rookie': { + 'Rookie Year': '2007' + }, 'Season 2019': { + 'Participate?': 'False' + }, + 'Competition Names': { + 'Competition': 'Pacific Northwest Regional 2007' + }, 'Competition Location': { + 'Location of Competition': 'Pioneer Courthouse Square in Portland, OR, USA' + }, + 'Awards': { + 'Award': 'None' + } + } + +team_3333 = { + 'Location': { + 'Show location': 'Julesburg, CO, USA' + }, 'Rookie': { + 'Rookie Year': '2010' + }, 'Season_2019': { + 'Participate?': 'False' + }, + 'Competition Names': { + 'Competition': 'Colorado Regional 2010' + }, 'Competition Location': { + 'Location of Competition': 'Ritchie Center in Denver, CO, USA' + }, 'Awards': { + 'Award': 'Judges Award' + } + } + +team_5555 = { + 'Location': { + 'Show Location': 'Warren, Michigan' + }, 'Rookie': { + 'Rookie Year': '2015' + }, 'Season 2019': { + 'Participate?': 'True' + }, 'Competition Names': [ + 'FIM District Center Line Event', + 'FIM District Marysville Event' + ], 'Competition Location': [ + 'Center Line, MI, USA', + 'Marysville, MI, USA' + ], 'Awards': { + 'Award': 'District Event Winner' + } + } print(Robot_Team) From 45d50fd6d4a618ef1ce5b1e4752c4b93bdccad94 Mon Sep 17 00:00:00 2001 From: jonathanhoNumberXIII Date: Thu, 26 Sep 2019 19:48:56 -0700 Subject: [PATCH 04/17] I changed the Dictionary code so it's now a nested Dictionary that contains all the data for each team --- ch_1_assign_Jonathan_Ho.py | 297 ++++++++++++++++++++++++------------- 1 file changed, 198 insertions(+), 99 deletions(-) diff --git a/ch_1_assign_Jonathan_Ho.py b/ch_1_assign_Jonathan_Ho.py index 2957351..288566c 100644 --- a/ch_1_assign_Jonathan_Ho.py +++ b/ch_1_assign_Jonathan_Ho.py @@ -1,21 +1,8 @@ Robot_Team = input("What Robotics Team do you want to look into?") -""" -Robot_Location = -Robot_Debut -Robot_2019 -Robot_comp_names -Robot_comp_locate -Robot_comp_award -""" - -team_1678 = { - 'Location': { - 'Show location': 'Davis, CA, USA' - }, 'Rookie': { - 'Rookie Year': '2005' - }, 'Season 2019': { - 'Participate?': 'True' - }, +Robot_Stat = input("What statistic would you like to see?") + + +Robot_TeamB = {1678: {'Location': 'Davis, CA, USA', 'Rookie': '2005', 'Participate?': 'Yes', 'Competition Names': [ 'Central Valley Regional', 'Sacramento Regional', @@ -36,17 +23,8 @@ 'Regional Chairman`s Award and Regional Winners', 'FIRST Dean`s List Finalist Award (Katie Stachowicz), Regional Winners, and Industrial Design Award sponsored by General Motors', 'Regional Winners and Excellence in Engineering Award sponsored by Delphi', 'Championship Subdivision Winner and Entrepreneurship Award sponsored by Kleiner Perkins Caufield and Byers' - ,] - } - -team_1111 = { - 'Location': { - 'Show location': 'Edgewater, Maryland, USA' - }, 'Rookie': { - 'Rookie Year': '2003' - }, 'Season 2019': { - 'Participate?': 'True' - }, + ,]}, + 1111: {'Location': 'Edgewater, Maryland, USA', 'Rookie': '2003', 'Participate?': 'Yes', 'Competition Names': [ 'CHS District Bethesda MD Event sponsored by Bechtel', 'CHS District Owings Mills MD Event sponsored by Leidos', @@ -61,93 +39,214 @@ 'Autonomous Award sponsored by Ford', 'District Chairman`s Award', 'Team Spirit Award sponsored by FCA Foundation' - ] - } - -team_2222 = { - 'Location': { - 'Show location': 'Tacoma, WA, USA' - }, 'Rookie': { - 'Rookie Year': '2007' - }, 'Season 2019': { - 'Participate?': 'False' - }, - 'Competition Names': { - 'Competition': 'Pacific Northwest Regional 2007' - }, 'Competition Location': { - 'Location of Competition': 'Pioneer Courthouse Square in Portland, OR, USA' + ]}, + 2222: {'Location': 'Tacoma, WA, USA', 'Rookie': '2007', 'Participate?': 'No', 'Competition': 'Pacific Northwest Regional 2007', + 'Competition Location': 'Pioneer Courthouse Square in Portland, OR, USA', 'Award': 'None'}, + 3333: {'Location': 'Julesburg, CO, USA', 'Rookie': '2010', 'Participate?': 'No', 'Competition': 'Colorado Regional 2010', + 'Competition Location': 'Ritchie Center in Denver, CO, USA', 'Award': 'Judges Award' }, - 'Awards': { - 'Award': 'None' - } - } - -team_3333 = { - 'Location': { - 'Show location': 'Julesburg, CO, USA' - }, 'Rookie': { - 'Rookie Year': '2010' - }, 'Season_2019': { - 'Participate?': 'False' - }, - 'Competition Names': { - 'Competition': 'Colorado Regional 2010' - }, 'Competition Location': { - 'Location of Competition': 'Ritchie Center in Denver, CO, USA' - }, 'Awards': { - 'Award': 'Judges Award' - } - } - -team_5555 = { - 'Location': { - 'Show Location': 'Warren, Michigan' - }, 'Rookie': { - 'Rookie Year': '2015' - }, 'Season 2019': { - 'Participate?': 'True' - }, 'Competition Names': [ - 'FIM District Center Line Event', - 'FIM District Marysville Event' - ], 'Competition Location': [ - 'Center Line, MI, USA', - 'Marysville, MI, USA' - ], 'Awards': { - 'Award': 'District Event Winner' - } - } - + 5555: {'Show Location': 'Warren, Michigan', 'Rookie Year': '2015', 'Participate?': 'Yes', + 'Competitions': ['FIM District Center Line Event','FIM District Marysville Event'], 'Competitions Location': ['Center Line, MI, USA', 'Marysville, MI, USA'], + 'Awards': 'District Event Winner'}} print(Robot_Team) if Robot_Team == "1678": - print("Here's their profile!") - print(team_1678) + print(Robot_Stat) + if Robot_Stat == "Location" or Robot_Stat == "Team Location": + print("Here you go!") + print(Robot_TeamB[1678]['Location']) + elif Robot_Stat == "Rookie Year" or Robot_Stat == "Team Debut": + print("Processing!") + print(Robot_TeamB[1678]['Rookie']) + elif Robot_Stat == "2019" or Robot_Stat == "Did they participate in the 2019 competition?": + print("Voila!") + print(Robot_TeamB[1678]['Participate?']) + elif Robot_Stat == "Competitions" or Robot_Stat == "Names of Competitions": + print("Bang!") + print(Robot_TeamB[1678]['Competition Names']) + elif Robot_Stat == "Locations of Competition" or Robot_Stat == "Competition Locations": + print("Fresh from the oven! Note that these are in order with the competition names. Best if you check that, first") + print(Robot_TeamB[1678]['Competition Location']) + elif Robot_Stat == "Awards" or Robot_Stat == "Awards Given": + print("Flash!") + print(Robot_TeamB[1678]['Awards']) + else: + print("*Database.exe has stopped working. Try the code again. :P*") + elif Robot_Team == "1111": - print("Here's their profile!") - print(team_1111) + print(Robot_Stat) + if Robot_Stat == "Location" or Robot_Stat == "Team Location": + print("Here you go!") + print(Robot_TeamB[1111]['Location']) + elif Robot_Stat == "Rookie Year" or Robot_Stat == "Team Debut": + print("Processing!") + print(Robot_TeamB[1111]['Rookie']) + elif Robot_Stat == "2019" or Robot_Stat == "Did they participate in the 2019 competition?": + print("Voila!") + print(Robot_TeamB[1111]['Participate?']) + elif Robot_Stat == "Competitions" or Robot_Stat == "Names of Competitions": + print("Bang!") + print(Robot_TeamB[1111]['Competition Names']) + elif Robot_Stat == "Locations of Competition" or Robot_Stat == "Competition Locations": + print("Fresh from the oven! Note that these are in order with the competition names. Best if you check that, first") + print(Robot_TeamB[1111]['Competition Location']) + elif Robot_Stat == "Awards" or Robot_Stat == "Awards Given": + print("Flash!") + print(Robot_TeamB[1111]['Awards']) + else: + print("*Database.exe has stopped working. Try the code again. :P*") + elif Robot_Team == "2222": - print("Here's their profile!") - print(team_2222) + print(Robot_Stat) + if Robot_Stat == "Location" or Robot_Stat == "Team Location": + print("Here you go!") + print(Robot_TeamB[2222]['Location']) + elif Robot_Stat == "Rookie Year" or Robot_Stat == "Team Debut": + print("Processing!") + print(Robot_TeamB[2222]['Rookie']) + elif Robot_Stat == "2019" or Robot_Stat == "Did they participate in the 2019 competition?": + print("Voila!") + print(Robot_TeamB[2222]['Participate?']) + elif Robot_Stat == "Competitions" or Robot_Stat == "Names of Competitions": + print("Bang!") + print(Robot_TeamB[2222]['Competition']) + elif Robot_Stat == "Locations of Competition" or Robot_Stat == "Competition Location": + print("Fresh from the oven! Note that these are in order with the competition names. Best if you check that, first") + print(Robot_TeamB[2222]['Competition Location']) + elif Robot_Stat == "Awards" or Robot_Stat == "Awards Given": + print("Flash!") + print(Robot_TeamB[2222]['Award']) + else: + print("*Database.exe has stopped working. Try the code again. :P*") + elif Robot_Team == "3333": - print("Here's their profile!") - print(team_3333) + print(Robot_Stat) + if Robot_Stat == "Location" or Robot_Stat == "Team Location": + print("Here you go!") + print(Robot_TeamB[3333]['Location']) + elif Robot_Stat == "Rookie Year" or Robot_Stat == "Team Debut": + print("Processing!") + print(Robot_TeamB[3333]['Rookie']) + elif Robot_Stat == "2019" or Robot_Stat == "Did they participate in the 2019 competition?": + print("Voila!") + print(Robot_TeamB[3333]['Participate?']) + elif Robot_Stat == "Competitions" or Robot_Stat == "Names of Competitions": + print("Bang!") + print(Robot_TeamB[3333]['Competition']) + elif Robot_Stat == "Locations of Competition" or Robot_Stat == "Competition Locations": + print("Fresh from the oven! Note that these are in order with the competition names. Best if you check that, first") + print(Robot_TeamB[3333]['Competition Location']) + elif Robot_Stat == "Awards" or Robot_Stat == "Awards Given": + print("Flash!") + print(Robot_TeamB[3333]['Award']) + else: + print("*Database.exe has stopped working. Try the code again. :P*") + elif Robot_Team == "5555": - print("Here's their profile!") - print(team_5555) + print(Robot_Stat) + if Robot_Stat == "Location" or Robot_Stat == "Team Location": + print("Here you go!") + print(Robot_TeamB[5555]['Location']) + elif Robot_Stat == "Rookie Year" or Robot_Stat == "Team Debut": + print("Processing!") + print(Robot_TeamB[5555]['Rookie']) + elif Robot_Stat == "2019" or Robot_Stat == "Did they participate in the 2019 competition?": + print("Voila!") + print(Robot_TeamB[5555]['Participate?']) + elif Robot_Stat == "Competitions" or Robot_Stat == "Names of Competitions": + print("Bang!") + print(Robot_TeamB[5555]['Competitions']) + elif Robot_Stat == "Locations of Competition" or Robot_Stat == "Competitions Location": + print("Fresh from the oven! Note that these are in order with the competition names. Best if you check that, first") + print(Robot_TeamB[5555]['Competition Location']) + elif Robot_Stat == "Awards" or Robot_Stat == "Awards Given": + print("Flash!") + print(Robot_TeamB[5555]['Awards']) + else: + print("*Database.exe has stopped working. Try the code again. :P*") + else: print("Sorry! I didn't get that!") -""" -team_1678_location = {'Show location': 'Davis'} -team_1678_rookie_year = -team_1678_season_par = -team_1678_comp_names = +''' +# Citrus Circuits location +location_1678 = {'Location': 'Davis, CA, USA'} +# 1678's first debut +rookie_1678 = {'Rookie Year': '2005'} +# If 1678 participated in the 2019 competition or not +Season_2019_1678 = {'Participate?': 'Yes'} +# All the Competitions 1678 participated in +Names_1678 = {'Competition Names': [ + 'Central Valley Regional', + 'Sacramento Regional', + 'Aerospace Valley Regional', + 'Carver Division', + 'Einstein Field', + 'RCC Qianjiang International Robotics Invitational']} +# Where each Competition was located. +C_Locate_1678 = {'Competition Location': [ + 'Fresno, CA, USA', + 'Davis, CA, USA', + 'Lancaster, CA, USA', + 'Houston, TX, USA', + 'Houston TX, USA', + 'Hangzhou, Zhejiang, China']} +# What Awards were they given? +Awards_1678 = {'Awards': [ + 'Regional Chairman`s Award and Regional Winners', + 'FIRST Dean`s List Finalist Award (Katie Stachowicz), Regional Winners, and Industrial Design Award sponsored by General Motors', + 'Regional Winners and Excellence in Engineering Award sponsored by Delphi', 'Championship Subdivision Winner and Entrepreneurship Award sponsored by Kleiner Perkins Caufield and Byers' + ,]} +team_1678 = [location_1678, rookie_1678, Season_2019_1678, Names_1678, C_Locate_1678, Awards_1678] -""" \ No newline at end of file + +location_1111 = {'Show location': 'Edgewater, Maryland, USA'} +rookie_1111: {'Rookie Year': '2003'}, +Season_2019_1111 = {'Participate?': 'True'} +Names_1111 = {'Competition Names': [ + 'CHS District Bethesda MD Event sponsored by Bechtel', + 'CHS District Owings Mills MD Event sponsored by Leidos', + 'FIRST Chesapeake District Championship']} +C_Locate_1111 = {'Competition Location': [ + 'Bethesda, MD 20817, USA', + 'Owings Mills, MD 21117, USA', + 'Fairfax, VA 22030, USA']}, +Awards_1111 = {'Awards': [ + 'Autonomous Award sponsored by Ford', + 'District Chairman`s Award', + 'Team Spirit Award sponsored by FCA Foundation']} +team_1111 = [location_1111, rookie_1111, Season_2019_1111, Names_1111, C_Locate_1111, Awards_1111] + +location_2222 = {'Show location': 'Tacoma, WA, USA'} +rookie_2222 = {'Rookie Year': '2007'} +Season_2019_2222 = {'Participate?': 'No'} +Names_2222 = {'Competition': 'Pacific Northwest Regional 2007'} +C_Locate_2222 = {'Location of Competition': 'Pioneer Courthouse Square in Portland, OR, USA'} +Awards_2222 = {'Award': 'None'} +team_2222 = [location_2222, rookie_2222, Season_2019_2222, Names_2222, C_Locate_2222, Awards_2222] + + +location_3333 = {'Show location': 'Julesburg, CO, USA'} +rookie_3333 = {'Rookie Year': '2010'} +Season_2019_3333 = {'Participate?': 'No'} +Names_3333 = {'Competition': 'Colorado Regional 2010'} +C_Locate_3333 = {'Location of Competition': 'Ritchie Center in Denver, CO, USA'} +Awards_3333 = {'Award': 'Judges Award'} + +team_3333 = [location_3333, rookie_3333, Season_2019_3333, Names_3333, C_Locate_3333, Awards_3333] + +location_5555 = {'Show Location': 'Warren, Michigan'} +rookie_5555 = {'Rookie Year': '2015'} +Season_2019_5555 = {'Participate?': 'True'} +Names_5555 = ['FIM District Center Line Event','FIM District Marysville Event'] +C_Locate_5555 = ['Center Line, MI, USA', 'Marysville, MI, USA'] +Awards_5555 = {'Award': 'District Event Winner'} +team_5555 = [location_5555, rookie_5555, Season_2019_5555, Names_5555, C_Locate_5555, Awards_5555] +''' \ No newline at end of file From 6772c2efe82399d55bd7fe3dfd7f27a2a6be2702 Mon Sep 17 00:00:00 2001 From: jonathanhoNumberXIII Date: Thu, 26 Sep 2019 20:28:30 -0700 Subject: [PATCH 05/17] I simply deleted the larger portion of the code, and printed out a nested dictionary with the input questions inside of it. --- ch_1_assign_Jonathan_Ho.py | 204 +------------------------------------ 1 file changed, 2 insertions(+), 202 deletions(-) diff --git a/ch_1_assign_Jonathan_Ho.py b/ch_1_assign_Jonathan_Ho.py index 288566c..76eb326 100644 --- a/ch_1_assign_Jonathan_Ho.py +++ b/ch_1_assign_Jonathan_Ho.py @@ -1,4 +1,4 @@ -Robot_Team = input("What Robotics Team do you want to look into?") +Robot_Team = int(input("What Robotics Team do you want to look into?")) Robot_Stat = input("What statistic would you like to see?") @@ -49,204 +49,4 @@ 'Competitions': ['FIM District Center Line Event','FIM District Marysville Event'], 'Competitions Location': ['Center Line, MI, USA', 'Marysville, MI, USA'], 'Awards': 'District Event Winner'}} -print(Robot_Team) -if Robot_Team == "1678": - print(Robot_Stat) - if Robot_Stat == "Location" or Robot_Stat == "Team Location": - print("Here you go!") - print(Robot_TeamB[1678]['Location']) - elif Robot_Stat == "Rookie Year" or Robot_Stat == "Team Debut": - print("Processing!") - print(Robot_TeamB[1678]['Rookie']) - elif Robot_Stat == "2019" or Robot_Stat == "Did they participate in the 2019 competition?": - print("Voila!") - print(Robot_TeamB[1678]['Participate?']) - elif Robot_Stat == "Competitions" or Robot_Stat == "Names of Competitions": - print("Bang!") - print(Robot_TeamB[1678]['Competition Names']) - elif Robot_Stat == "Locations of Competition" or Robot_Stat == "Competition Locations": - print("Fresh from the oven! Note that these are in order with the competition names. Best if you check that, first") - print(Robot_TeamB[1678]['Competition Location']) - elif Robot_Stat == "Awards" or Robot_Stat == "Awards Given": - print("Flash!") - print(Robot_TeamB[1678]['Awards']) - else: - print("*Database.exe has stopped working. Try the code again. :P*") - - -elif Robot_Team == "1111": - print(Robot_Stat) - if Robot_Stat == "Location" or Robot_Stat == "Team Location": - print("Here you go!") - print(Robot_TeamB[1111]['Location']) - elif Robot_Stat == "Rookie Year" or Robot_Stat == "Team Debut": - print("Processing!") - print(Robot_TeamB[1111]['Rookie']) - elif Robot_Stat == "2019" or Robot_Stat == "Did they participate in the 2019 competition?": - print("Voila!") - print(Robot_TeamB[1111]['Participate?']) - elif Robot_Stat == "Competitions" or Robot_Stat == "Names of Competitions": - print("Bang!") - print(Robot_TeamB[1111]['Competition Names']) - elif Robot_Stat == "Locations of Competition" or Robot_Stat == "Competition Locations": - print("Fresh from the oven! Note that these are in order with the competition names. Best if you check that, first") - print(Robot_TeamB[1111]['Competition Location']) - elif Robot_Stat == "Awards" or Robot_Stat == "Awards Given": - print("Flash!") - print(Robot_TeamB[1111]['Awards']) - else: - print("*Database.exe has stopped working. Try the code again. :P*") - - -elif Robot_Team == "2222": - print(Robot_Stat) - if Robot_Stat == "Location" or Robot_Stat == "Team Location": - print("Here you go!") - print(Robot_TeamB[2222]['Location']) - elif Robot_Stat == "Rookie Year" or Robot_Stat == "Team Debut": - print("Processing!") - print(Robot_TeamB[2222]['Rookie']) - elif Robot_Stat == "2019" or Robot_Stat == "Did they participate in the 2019 competition?": - print("Voila!") - print(Robot_TeamB[2222]['Participate?']) - elif Robot_Stat == "Competitions" or Robot_Stat == "Names of Competitions": - print("Bang!") - print(Robot_TeamB[2222]['Competition']) - elif Robot_Stat == "Locations of Competition" or Robot_Stat == "Competition Location": - print("Fresh from the oven! Note that these are in order with the competition names. Best if you check that, first") - print(Robot_TeamB[2222]['Competition Location']) - elif Robot_Stat == "Awards" or Robot_Stat == "Awards Given": - print("Flash!") - print(Robot_TeamB[2222]['Award']) - else: - print("*Database.exe has stopped working. Try the code again. :P*") - - - -elif Robot_Team == "3333": - print(Robot_Stat) - if Robot_Stat == "Location" or Robot_Stat == "Team Location": - print("Here you go!") - print(Robot_TeamB[3333]['Location']) - elif Robot_Stat == "Rookie Year" or Robot_Stat == "Team Debut": - print("Processing!") - print(Robot_TeamB[3333]['Rookie']) - elif Robot_Stat == "2019" or Robot_Stat == "Did they participate in the 2019 competition?": - print("Voila!") - print(Robot_TeamB[3333]['Participate?']) - elif Robot_Stat == "Competitions" or Robot_Stat == "Names of Competitions": - print("Bang!") - print(Robot_TeamB[3333]['Competition']) - elif Robot_Stat == "Locations of Competition" or Robot_Stat == "Competition Locations": - print("Fresh from the oven! Note that these are in order with the competition names. Best if you check that, first") - print(Robot_TeamB[3333]['Competition Location']) - elif Robot_Stat == "Awards" or Robot_Stat == "Awards Given": - print("Flash!") - print(Robot_TeamB[3333]['Award']) - else: - print("*Database.exe has stopped working. Try the code again. :P*") - - -elif Robot_Team == "5555": - print(Robot_Stat) - if Robot_Stat == "Location" or Robot_Stat == "Team Location": - print("Here you go!") - print(Robot_TeamB[5555]['Location']) - elif Robot_Stat == "Rookie Year" or Robot_Stat == "Team Debut": - print("Processing!") - print(Robot_TeamB[5555]['Rookie']) - elif Robot_Stat == "2019" or Robot_Stat == "Did they participate in the 2019 competition?": - print("Voila!") - print(Robot_TeamB[5555]['Participate?']) - elif Robot_Stat == "Competitions" or Robot_Stat == "Names of Competitions": - print("Bang!") - print(Robot_TeamB[5555]['Competitions']) - elif Robot_Stat == "Locations of Competition" or Robot_Stat == "Competitions Location": - print("Fresh from the oven! Note that these are in order with the competition names. Best if you check that, first") - print(Robot_TeamB[5555]['Competition Location']) - elif Robot_Stat == "Awards" or Robot_Stat == "Awards Given": - print("Flash!") - print(Robot_TeamB[5555]['Awards']) - else: - print("*Database.exe has stopped working. Try the code again. :P*") - - -else: - print("Sorry! I didn't get that!") - - -''' -# Citrus Circuits location -location_1678 = {'Location': 'Davis, CA, USA'} -# 1678's first debut -rookie_1678 = {'Rookie Year': '2005'} -# If 1678 participated in the 2019 competition or not -Season_2019_1678 = {'Participate?': 'Yes'} -# All the Competitions 1678 participated in -Names_1678 = {'Competition Names': [ - 'Central Valley Regional', - 'Sacramento Regional', - 'Aerospace Valley Regional', - 'Carver Division', - 'Einstein Field', - 'RCC Qianjiang International Robotics Invitational']} -# Where each Competition was located. -C_Locate_1678 = {'Competition Location': [ - 'Fresno, CA, USA', - 'Davis, CA, USA', - 'Lancaster, CA, USA', - 'Houston, TX, USA', - 'Houston TX, USA', - 'Hangzhou, Zhejiang, China']} -# What Awards were they given? -Awards_1678 = {'Awards': [ - 'Regional Chairman`s Award and Regional Winners', - 'FIRST Dean`s List Finalist Award (Katie Stachowicz), Regional Winners, and Industrial Design Award sponsored by General Motors', - 'Regional Winners and Excellence in Engineering Award sponsored by Delphi', 'Championship Subdivision Winner and Entrepreneurship Award sponsored by Kleiner Perkins Caufield and Byers' - ,]} -team_1678 = [location_1678, rookie_1678, Season_2019_1678, Names_1678, C_Locate_1678, Awards_1678] - - -location_1111 = {'Show location': 'Edgewater, Maryland, USA'} -rookie_1111: {'Rookie Year': '2003'}, -Season_2019_1111 = {'Participate?': 'True'} -Names_1111 = {'Competition Names': [ - 'CHS District Bethesda MD Event sponsored by Bechtel', - 'CHS District Owings Mills MD Event sponsored by Leidos', - 'FIRST Chesapeake District Championship']} -C_Locate_1111 = {'Competition Location': [ - 'Bethesda, MD 20817, USA', - 'Owings Mills, MD 21117, USA', - 'Fairfax, VA 22030, USA']}, -Awards_1111 = {'Awards': [ - 'Autonomous Award sponsored by Ford', - 'District Chairman`s Award', - 'Team Spirit Award sponsored by FCA Foundation']} -team_1111 = [location_1111, rookie_1111, Season_2019_1111, Names_1111, C_Locate_1111, Awards_1111] - -location_2222 = {'Show location': 'Tacoma, WA, USA'} -rookie_2222 = {'Rookie Year': '2007'} -Season_2019_2222 = {'Participate?': 'No'} -Names_2222 = {'Competition': 'Pacific Northwest Regional 2007'} -C_Locate_2222 = {'Location of Competition': 'Pioneer Courthouse Square in Portland, OR, USA'} -Awards_2222 = {'Award': 'None'} -team_2222 = [location_2222, rookie_2222, Season_2019_2222, Names_2222, C_Locate_2222, Awards_2222] - - -location_3333 = {'Show location': 'Julesburg, CO, USA'} -rookie_3333 = {'Rookie Year': '2010'} -Season_2019_3333 = {'Participate?': 'No'} -Names_3333 = {'Competition': 'Colorado Regional 2010'} -C_Locate_3333 = {'Location of Competition': 'Ritchie Center in Denver, CO, USA'} -Awards_3333 = {'Award': 'Judges Award'} - -team_3333 = [location_3333, rookie_3333, Season_2019_3333, Names_3333, C_Locate_3333, Awards_3333] - -location_5555 = {'Show Location': 'Warren, Michigan'} -rookie_5555 = {'Rookie Year': '2015'} -Season_2019_5555 = {'Participate?': 'True'} -Names_5555 = ['FIM District Center Line Event','FIM District Marysville Event'] -C_Locate_5555 = ['Center Line, MI, USA', 'Marysville, MI, USA'] -Awards_5555 = {'Award': 'District Event Winner'} -team_5555 = [location_5555, rookie_5555, Season_2019_5555, Names_5555, C_Locate_5555, Awards_5555] -''' \ No newline at end of file +print(Robot_TeamB[Robot_Team][Robot_Stat]) From e21d2febb72284cd6451d9be0e50f83e1b943086 Mon Sep 17 00:00:00 2001 From: jonathanhoNumberXIII <55220257+jonathanhoNumberXIII@users.noreply.github.com> Date: Thu, 26 Sep 2019 20:35:13 -0700 Subject: [PATCH 06/17] Update ch_1_assign_Jonathan_Ho.py --- ch_1_assign_Jonathan_Ho.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch_1_assign_Jonathan_Ho.py b/ch_1_assign_Jonathan_Ho.py index 76eb326..ba68a29 100644 --- a/ch_1_assign_Jonathan_Ho.py +++ b/ch_1_assign_Jonathan_Ho.py @@ -48,5 +48,5 @@ 5555: {'Show Location': 'Warren, Michigan', 'Rookie Year': '2015', 'Participate?': 'Yes', 'Competitions': ['FIM District Center Line Event','FIM District Marysville Event'], 'Competitions Location': ['Center Line, MI, USA', 'Marysville, MI, USA'], 'Awards': 'District Event Winner'}} - +# Prints out the input variables above and the answers for specific information are shown once the questions are answered print(Robot_TeamB[Robot_Team][Robot_Stat]) From 375ca3e36413a3d596b11a6c55c0749c58eae7ce Mon Sep 17 00:00:00 2001 From: jonathanhoNumberXIII Date: Thu, 3 Oct 2019 20:15:25 -0700 Subject: [PATCH 07/17] My code can add any team, by name or number, and remove them as well as search to ensure the team is in the database. They can also see certain team information and modify it to their li and modify it to their liking. --- ch_2_assign_Jonathan_Ho.py | 65 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 ch_2_assign_Jonathan_Ho.py diff --git a/ch_2_assign_Jonathan_Ho.py b/ch_2_assign_Jonathan_Ho.py new file mode 100644 index 0000000..2f8938c --- /dev/null +++ b/ch_2_assign_Jonathan_Ho.py @@ -0,0 +1,65 @@ +teams = [] + +Robot_Team_A = {"1678": {'Number': '1678', 'Name': 'Citrus Circuits', 'Prog. Language': 'Java', 'Width': '15 inches', 'Length': '16 inches', 'Camera Vision?': 'Does not have camera vision system', + 'Drivetrain Motors': '12 drivetrain motors'}} +Robot_Team_B = {"744": {'Number': '744', 'Name': 'Shark Attack', 'Prog. Language': 'C++', 'Width': '13 inches', 'Length': '15 inches', 'Camera Vision?': 'Does have camera vision system', + 'Drivetrain Motors': '10 drivetrain motors'}} +Robot_Team_C = {"5852": {'Number': '5852', 'Name': 'Illusion Robotics', 'Prog. Language': 'C+', 'Width': '17 inches', 'Length': '16 inches', 'Camera Vision?': 'Does not have camera video system', + 'Drivetrain Motors': '9 drivetrain motors'}} + +Robot_Team_all = {'1678': Robot_Team_A, '744': Robot_Team_B, '5852': Robot_Team_C} + +def list_teams(list_of_teams): + for team in list_of_teams: + print(str(team) + "\n") + +def add(): + Player_Add = input("Let's add a team! Choose any team.") + if Player_Add.isalpha and Player_Add != None: + teams.append(Player_Add) + print(teams) + +def remove(): + Player_Delete = input("Let's see. What team do you want to delete?") + if Player_Delete.isalpha and Player_Delete != None: + teams.remove(Player_Delete) + print(teams) + +def view(): + view_input = input("Whose data do you want to view?: ") + team_information_input = input("What datapoint would you like to see?: ") + print(Robot_Team_all[view_input][view_input][team_information_input]) + +def modify(): + modifier_team = input("\n team's data would you like to modify?: ") + modifier_datapoint = input("\nWhat datapoint would you like to modify?: ") + print("The current value for " + str(modifier_datapoint) + " of team " + str(modifier_team) + " is " + Robot_Team_all[modifier_team][modifier_team][modifier_datapoint]) + modifiee_datapoint = input("\nWhat value would you like to change it to?: ") + Robot_Team_all[modifier_team][modifier_team][modifier_datapoint] = modifiee_datapoint + print("The new value has been changed to: " + str(modifiee_datapoint)) + +def search(): + search_team = input("Which team do you want to look for?") + print("Is " + str(search_team) + " in your list of teams?: " + str(search_team in teams)); + + +while True: + Player_Use = input("Hello, User. Welcome to the FIRST Robotics Team Menu! What would you like to do?") + if Player_Use == 'add' or Player_Use == 'Add': + add() + elif Player_Use == 'view' or Player_Use == 'View': + view() + elif Player_Use == 'remove' or Player_Use == 'Remove': + remove() + elif Player_Use == 'search' or Player_Use == 'Search': + search() + elif Player_Use.lower() == "modify": + modify() + elif Player_Use.lower() == "view all teams": + list_teams(teams) + elif Player_Use == "quit": + break; + else: + print("Sorry! I didn't get that! Please try again.") + + From 1b64bf9ff01b7c7d34b807a59d303a9a9adb39af Mon Sep 17 00:00:00 2001 From: jonathanhoNumberXIII Date: Thu, 10 Oct 2019 19:28:31 -0700 Subject: [PATCH 08/17] This assignment is a combination of the two before. I made a nested dictionary from assignment one and used functions from assignment two to make it a database with all the dictionaries. --- ch_3_assign_Jonathan_Ho.py | 113 +++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 ch_3_assign_Jonathan_Ho.py diff --git a/ch_3_assign_Jonathan_Ho.py b/ch_3_assign_Jonathan_Ho.py new file mode 100644 index 0000000..41c4db9 --- /dev/null +++ b/ch_3_assign_Jonathan_Ho.py @@ -0,0 +1,113 @@ +Team_DataA = [] + +Team_DataB = {'1678': {'Name': 'Citrus Circuits', 'Location': 'Davis, CA, USA', 'Rookie': '2005', + 'Competition Names': [ + 'Central Valley Regional', + 'Sacramento Regional', + 'Aerospace Valley Regional', + 'Carver Division', + 'Einstein Field', + 'RCC Qianjiang International Robotics Invitational' + ], + + 'Competition Location': [ + 'Fresno, CA, USA', + 'Davis, CA, USA', + 'Lancaster, CA, USA', + 'Houston, TX, USA', + 'Houston TX, USA', + 'Hangzhou, Zhejiang, China' + ], + 'Awards': [ + 'Regional Chairman`s Award and Regional Winners', + 'FIRST Dean`s List Finalist Award (Katie Stachowicz), Regional Winners, and Industrial Design Award sponsored by General Motors', + 'Regional Winners and Excellence in Engineering Award sponsored by Delphi', 'Championship Subdivision Winner and Entrepreneurship Award sponsored by Kleiner Perkins Caufield and Byers' + ,]}, + + '41': {'Name': 'RoboWarriors', 'Location': 'Warren, NJ, USA', 'Rookie': '1997', + 'Competition Names': [ + 'FMA District Mount Olive Event', + 'FMA District Montgomery Event', + 'FIRST Mid-Atlantic District Championship' + ], + 'Competition Location': [ + 'Flanders, NJ, USA', + 'Skillman, NJ, USA', + 'Bethlehem, PA, USA' + ], + 'Awards': 'Innovation in Control Award sponsored by Rockwell Automation', + }, + + '7823': {'Name': 'Double Negative', 'Location': 'Rogers City, MI, USA', 'Rookie': '1997', + 'Competition Names': [ + 'FIM District Alpena Event #1', + 'FIM District Alpena Event #2', + 'Michigan State Championship - Ford Division', + ], + 'Competition Location': [ + 'Alpena, MI, USA', + 'Alpena, MI, USA', + 'University Center, MI, USA' + ], + 'Awards': [ + 'Highest Rookie Seed and Rookie Inspiration Award sponsored by National Instruments', + 'Rookie All Star Award and District Event Finalist', + 'Judges` Award' + ],} + } + +def list_teams_all(list_of_teams): + for Team_DataA in list_of_teams: + print(str(Team_DataA) + "\n") + +def add_team(): + Player_Add = input("Alright, let's add a some teams to our database! Choose a team or piece of info to place in the database. ") + if Player_Add.isalpha and Player_Add != None: + Team_DataA.append(Player_Add) + +def delete_team(): + Player_Delete = input("As you wish it. Which team would you like to remove from the database? ") + if Player_Delete.isalpha and Player_Delete != None: + Team_DataA.remove(Player_Delete) + +def view_info(): + #view_list = input("Sure! What list would you like to see?") + view_team = input("Now, which team would you like to view? ") + view_data = input("What would you like to know about it? ") + print(str(Team_DataB[view_team][view_data])) + +def modify_info(): + #change_list = input("\n Which list do you need to find your team?") + change_team = input("\n What team's data would you like to modify? ") + change_data = input("\n What datapoint would you like to change? ") + print("This team's current value for " + change_data + " is " + Team_DataB[change_team][change_data]) + change_datapoint = input("\n So what do you want to change about " + change_data + "? ") + Team_DataB[change_team][change_data] = change_datapoint + print("Drumroll! The team's new value has been modified to... " + str(change_datapoint) + "!") + +def search(): + team_search = input("What team would ya like to look for? ") + print("Let's see... is " + str(team_search) + " anywhere in our database? " + str(team_search in Team_DataA and team_search in Team_DataB)) + +while True: + Player_Control = input('''Good morning, afternoon, and evening to all! Welcome to our FIRST Robotics Menu! What would you like to do here? Type in 'add' to add a team to the database, 'remove' to remove it + 'view' to check a team's data, 'modify' to change the data of the team, 'search' to ensure the teams you added to the database are in there, and 'see all teams' to look at the data in + the database. To leave, just type 'quit'. + ''') + if Player_Control == 'add' or Player_Control == 'Add': + add_team() + elif Player_Control == 'remove' or Player_Control == 'delete': + delete_team() + elif Player_Control == 'view' or Player_Control == 'View': + view_info() + elif Player_Control == 'modify' or Player_Control == 'change': + modify_info() + elif Player_Control == 'search' or Player_Control == 'Search': + search() + elif Player_Control == 'see all teams': + list_teams_all(Team_DataA) + elif Player_Control == 'quit': + print("Gotcha! See ya around!") + break; + else: + print("Sorry! Did you say something else? I don't have that in my files. Please try again! :)") From 913c0867950e6957c17bd3b8e9bd50599292d81e Mon Sep 17 00:00:00 2001 From: jonathanhoNumberXIII Date: Wed, 16 Oct 2019 20:06:31 -0700 Subject: [PATCH 09/17] This modified code allows the user to add, remove, view, modify, search, and see all the teams within the team database made with several other teams plopped into it. --- ch_3_assign_Jonathan_Ho.py | 49 ++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/ch_3_assign_Jonathan_Ho.py b/ch_3_assign_Jonathan_Ho.py index 41c4db9..ba70a37 100644 --- a/ch_3_assign_Jonathan_Ho.py +++ b/ch_3_assign_Jonathan_Ho.py @@ -1,6 +1,4 @@ -Team_DataA = [] - -Team_DataB = {'1678': {'Name': 'Citrus Circuits', 'Location': 'Davis, CA, USA', 'Rookie': '2005', +Team_Data = {'1678': {'Name': 'Citrus Circuits', 'Location': 'Davis, CA, USA', 'Rookie': '2005', 'Competition Names': [ 'Central Valley Regional', 'Sacramento Regional', @@ -56,38 +54,47 @@ ],} } + + def list_teams_all(list_of_teams): - for Team_DataA in list_of_teams: - print(str(Team_DataA) + "\n") + for Team_Data in list_of_teams: + print(str(Team_Data) + "\n") def add_team(): Player_Add = input("Alright, let's add a some teams to our database! Choose a team or piece of info to place in the database. ") - if Player_Add.isalpha and Player_Add != None: - Team_DataA.append(Player_Add) + if Player_Add.isdigit and Player_Add != None: + Team_Data[Player_Add] = {} def delete_team(): Player_Delete = input("As you wish it. Which team would you like to remove from the database? ") - if Player_Delete.isalpha and Player_Delete != None: - Team_DataA.remove(Player_Delete) + if Player_Delete.isdigit and Player_Delete != None: + Team_Data.pop(Player_Delete) def view_info(): - #view_list = input("Sure! What list would you like to see?") + print("Just a head's up. Everything in the database for each team shown here is capitalized, so make sure the letter is uppercase for the second question. :P") view_team = input("Now, which team would you like to view? ") view_data = input("What would you like to know about it? ") - print(str(Team_DataB[view_team][view_data])) + if view_team in Team_Data and view_data in Team_Data[view_team]: + print(Team_Data[view_team][view_data]) + else: + print("Sorry. This isn't in the data files. Try again.") + def modify_info(): - #change_list = input("\n Which list do you need to find your team?") - change_team = input("\n What team's data would you like to modify? ") - change_data = input("\n What datapoint would you like to change? ") - print("This team's current value for " + change_data + " is " + Team_DataB[change_team][change_data]) - change_datapoint = input("\n So what do you want to change about " + change_data + "? ") - Team_DataB[change_team][change_data] = change_datapoint - print("Drumroll! The team's new value has been modified to... " + str(change_datapoint) + "!") + print("Just a head's up. Everything in the database for each team shown here is capitalized, so make sure the letter is uppercase for the second question. :P") + change_team = input("What team's data would you like to modify? ") + change_data = input("What datapoint would you like to change? ") + if change_team in Team_Data and change_data in Team_Data[change_team]: + print("This team's current value for " + change_data + " is " + Team_Data[change_team][change_data]) + change_datapoint = input("\n So what do you want to change about " + change_data + "? ") + Team_Data[change_team][change_data] = change_datapoint + print("Drumroll! The team's new value has been modified to... " + str(change_datapoint) + "!") + else: + print("Sorry. What you want to modify is not in our files. Try again.") def search(): team_search = input("What team would ya like to look for? ") - print("Let's see... is " + str(team_search) + " anywhere in our database? " + str(team_search in Team_DataA and team_search in Team_DataB)) + print("Let's see... is " + str(team_search) + " anywhere in our database? " + str(team_search in Team_Data)) while True: Player_Control = input('''Good morning, afternoon, and evening to all! Welcome to our FIRST Robotics Menu! What would you like to do here? Type in 'add' to add a team to the database, 'remove' to remove it @@ -105,9 +112,9 @@ def search(): elif Player_Control == 'search' or Player_Control == 'Search': search() elif Player_Control == 'see all teams': - list_teams_all(Team_DataA) + list_teams_all(Team_Data) elif Player_Control == 'quit': print("Gotcha! See ya around!") break; else: - print("Sorry! Did you say something else? I don't have that in my files. Please try again! :)") + print("Sorry! Did you say something else? Your reply is not valid. Please try again! :)") From 8d28dacc01577a57145445b6f715b8663f0fb34b Mon Sep 17 00:00:00 2001 From: jonathanhoNumberXIII Date: Thu, 24 Oct 2019 19:59:54 -0700 Subject: [PATCH 10/17] In this bundle of code, I'm using the Pythagorean Theorem for two-dimensional and three-dimensional shapes, mainly rectangular prisms and 2D triangles. The user is in a while loop while doing this, and he or she can exit when they type "exit". Unless they don't want to, they can enter their own numbers and allow the code to use the Pythagorean Theorem to calculate the distance between one point and another in the dimensional shape they choose. --- ch_4_assign_Jonathan_Ho.py | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 ch_4_assign_Jonathan_Ho.py diff --git a/ch_4_assign_Jonathan_Ho.py b/ch_4_assign_Jonathan_Ho.py new file mode 100644 index 0000000..76b3416 --- /dev/null +++ b/ch_4_assign_Jonathan_Ho.py @@ -0,0 +1,56 @@ +from math import sqrt + +# 2D Pythagorean Theorem +class Point(): + def __init__(self, x, y): + self.x = float(x) + self.y = float(y) + + # Pythagorean Theorem + def Distance(self): + hypo = self.x ** 2 + self.y ** 2 + return sqrt(hypo) + +# Three Dimensional Pythagorean Theorem +class Point_3D(Point): + def __init__(self, x, y, z): + self.z = float(z) + super().__init__(x, y) + + + def Distance(self): + hypo_2 = super().Distance() ** 2 + self.z ** 2 + return sqrt(hypo_2) + + +while True: + Operation = input("What type of dimension do you want to use for the Pythagorean Theorem? If you wish to leave, type 'exit'.") + if Operation == "2D": + x = input("Enter the first value of your first leg of your triangle.") + y = input("Enter the second value of your next leg.") + # + # Assure if x and y are integers + if x.isdigit() and y.isdigit(): + point = Point(x, y).Distance() + print(point) + else: + print("Sorry, the variable is not a number. Try again.") + + + elif Operation == "3D": + x = input("Enter the first value of the length of the side of your 3D rectangle.") + y = input("Enter the next value of the second length of your 3D rectangle.") + z = input("Now enter the height of your 3D rectangle") + # Validates if the inputs are integers for the code to use the if statement + if x.isdigit() and y.isdigit() and z.isdigit(): + calc_3D_point = Point_3D(x, y, z).Distance() + print(calc_3D_point) + else: + print("Sorry, your variable wasn't an integer. Try using a number.") + # If the user wishes to leave + elif Operation == "exit": + print("So long! Till we meet again.") + break; + # If the user types it incorrectly + else: + print("Sorry. Your response wasn't valid. Try 3D or 2D.") From 8f03d32a6293f21cca2ae43306dddb74e5e9c8b0 Mon Sep 17 00:00:00 2001 From: jonathanhoNumberXIII Date: Wed, 30 Oct 2019 20:39:11 -0700 Subject: [PATCH 11/17] This code has been updated and modified to make sure that there are no error messages while maintaining its primary function. This is an updated version of Chapter 2's assignmet --- ch_2_assign_Jonathan_Ho.py | 53 +++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/ch_2_assign_Jonathan_Ho.py b/ch_2_assign_Jonathan_Ho.py index 2f8938c..2dd08c8 100644 --- a/ch_2_assign_Jonathan_Ho.py +++ b/ch_2_assign_Jonathan_Ho.py @@ -1,13 +1,18 @@ teams = [] -Robot_Team_A = {"1678": {'Number': '1678', 'Name': 'Citrus Circuits', 'Prog. Language': 'Java', 'Width': '15 inches', 'Length': '16 inches', 'Camera Vision?': 'Does not have camera vision system', +Robot_Team_A = {'1678': {'Number': '1678', 'Name': 'Citrus Circuits', 'Prog. Language': 'Java', 'Width': '15 inches', 'Length': '16 inches', 'Camera Vision?': 'Does not have camera vision system', 'Drivetrain Motors': '12 drivetrain motors'}} -Robot_Team_B = {"744": {'Number': '744', 'Name': 'Shark Attack', 'Prog. Language': 'C++', 'Width': '13 inches', 'Length': '15 inches', 'Camera Vision?': 'Does have camera vision system', +Robot_Team_B = {'744': {'Number': '744', 'Name': 'Shark Attack', 'Prog. Language': 'C++', 'Width': '13 inches', 'Length': '15 inches', 'Camera Vision?': 'Does have camera vision system', 'Drivetrain Motors': '10 drivetrain motors'}} -Robot_Team_C = {"5852": {'Number': '5852', 'Name': 'Illusion Robotics', 'Prog. Language': 'C+', 'Width': '17 inches', 'Length': '16 inches', 'Camera Vision?': 'Does not have camera video system', +Robot_Team_C = {'5852': {'Number': '5852', 'Name': 'Illusion Robotics', 'Prog. Language': 'C+', 'Width': '17 inches', 'Length': '16 inches', 'Camera Vision?': 'Does not have camera video system', 'Drivetrain Motors': '9 drivetrain motors'}} -Robot_Team_all = {'1678': Robot_Team_A, '744': Robot_Team_B, '5852': Robot_Team_C} +Robot_Team_all = {'1678': {'Number': '1678', 'Name': 'Citrus Circuits', 'Prog. Language': 'Java', 'Width': '15 inches', 'Length': '16 inches', 'Camera Vision?': 'Does not have camera vision system', + 'Drivetrain Motors': '12 drivetrain motors'}, + '744': {'Number': '744', 'Name': 'Shark Attack', 'Prog. Language': 'C++', 'Width': '13 inches', 'Length': '15 inches', 'Camera Vision?': 'Does have camera vision system', + 'Drivetrain Motors': '10 drivetrain motors'}, + '5852': {'Number': '5852', 'Name': 'Illusion Robotics', 'Prog. Language': 'C+', 'Width': '17 inches', 'Length': '16 inches', 'Camera Vision?': 'Does not have camera video system', + 'Drivetrain Motors': '9 drivetrain motors'}} def list_teams(list_of_teams): for team in list_of_teams: @@ -22,29 +27,42 @@ def add(): def remove(): Player_Delete = input("Let's see. What team do you want to delete?") if Player_Delete.isalpha and Player_Delete != None: - teams.remove(Player_Delete) - print(teams) + if Player_Delete in teams: + teams.remove(Player_Delete) + print(teams) + else: + print("Sorry. That's not in the database. Try again.") def view(): view_input = input("Whose data do you want to view?: ") team_information_input = input("What datapoint would you like to see?: ") - print(Robot_Team_all[view_input][view_input][team_information_input]) + if view_input in Robot_Team_all and team_information_input in Robot_Team_all[view_input]: + print(Robot_Team_all[view_input][team_information_input]) + else: + print("Sorry. I don't think your value is in the data files. Make sure your values are strings and try again.") def modify(): - modifier_team = input("\n team's data would you like to modify?: ") + modifier_team = input("\n Whose team's data would you like to modify?: ") modifier_datapoint = input("\nWhat datapoint would you like to modify?: ") - print("The current value for " + str(modifier_datapoint) + " of team " + str(modifier_team) + " is " + Robot_Team_all[modifier_team][modifier_team][modifier_datapoint]) - modifiee_datapoint = input("\nWhat value would you like to change it to?: ") - Robot_Team_all[modifier_team][modifier_team][modifier_datapoint] = modifiee_datapoint - print("The new value has been changed to: " + str(modifiee_datapoint)) + if modifier_team in Robot_Team_all and modifier_datapoint in Robot_Team_all[modifier_team]: + print("The current value for " + str(modifier_datapoint) + " of team " + str(modifier_team) + " is " + Robot_Team_all[modifier_team][modifier_datapoint]) + modifiee_datapoint = input("\nWhat value would you like to change it to?: ") + Robot_Team_all[modifier_team][modifier_datapoint] = modifiee_datapoint + print("The new value has been changed to: " + str(modifiee_datapoint)) + else: + print("Sorry. I'm afraid your input is not in the database. Try again") def search(): - search_team = input("Which team do you want to look for?") - print("Is " + str(search_team) + " in your list of teams?: " + str(search_team in teams)); + search_team = input("Which team do you want to look for? ") + name_team = input("What is the name of the team, for safety measures? ") + if search_team in Robot_Team_all and name_team in Robot_Team_all[search_team]['Name']: + print(str(search_team in Robot_Team_all)) + else: + print(False) while True: - Player_Use = input("Hello, User. Welcome to the FIRST Robotics Team Menu! What would you like to do?") + Player_Use = input("Hello, User. Welcome to the FIRST Robotics Team Menu! What would you like to do? ") if Player_Use == 'add' or Player_Use == 'Add': add() elif Player_Use == 'view' or Player_Use == 'View': @@ -58,8 +76,7 @@ def search(): elif Player_Use.lower() == "view all teams": list_teams(teams) elif Player_Use == "quit": + print("Thanks for using this! See ya real soon!") break; else: - print("Sorry! I didn't get that! Please try again.") - - + print("Sorry! I didn't get that! Please try again.") \ No newline at end of file From d29421e0d6f2f7035d0b502eb67764d45cdebedf Mon Sep 17 00:00:00 2001 From: jonathanhoNumberXIII Date: Wed, 6 Nov 2019 20:27:37 -0800 Subject: [PATCH 12/17] Chapter 2 Assignment (Modified Again) This time, this code has only a blank dictionary, with the add function modified so it can move teams and data that the user inputs into the blank database. All other functions have been updated to. --- ch_2_assign_Jonathan_Ho.py | 53 ++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/ch_2_assign_Jonathan_Ho.py b/ch_2_assign_Jonathan_Ho.py index 2dd08c8..04ed720 100644 --- a/ch_2_assign_Jonathan_Ho.py +++ b/ch_2_assign_Jonathan_Ho.py @@ -1,31 +1,46 @@ -teams = [] - -Robot_Team_A = {'1678': {'Number': '1678', 'Name': 'Citrus Circuits', 'Prog. Language': 'Java', 'Width': '15 inches', 'Length': '16 inches', 'Camera Vision?': 'Does not have camera vision system', - 'Drivetrain Motors': '12 drivetrain motors'}} -Robot_Team_B = {'744': {'Number': '744', 'Name': 'Shark Attack', 'Prog. Language': 'C++', 'Width': '13 inches', 'Length': '15 inches', 'Camera Vision?': 'Does have camera vision system', - 'Drivetrain Motors': '10 drivetrain motors'}} -Robot_Team_C = {'5852': {'Number': '5852', 'Name': 'Illusion Robotics', 'Prog. Language': 'C+', 'Width': '17 inches', 'Length': '16 inches', 'Camera Vision?': 'Does not have camera video system', - 'Drivetrain Motors': '9 drivetrain motors'}} +teams = {} +''' Robot_Team_all = {'1678': {'Number': '1678', 'Name': 'Citrus Circuits', 'Prog. Language': 'Java', 'Width': '15 inches', 'Length': '16 inches', 'Camera Vision?': 'Does not have camera vision system', 'Drivetrain Motors': '12 drivetrain motors'}, '744': {'Number': '744', 'Name': 'Shark Attack', 'Prog. Language': 'C++', 'Width': '13 inches', 'Length': '15 inches', 'Camera Vision?': 'Does have camera vision system', 'Drivetrain Motors': '10 drivetrain motors'}, '5852': {'Number': '5852', 'Name': 'Illusion Robotics', 'Prog. Language': 'C+', 'Width': '17 inches', 'Length': '16 inches', 'Camera Vision?': 'Does not have camera video system', 'Drivetrain Motors': '9 drivetrain motors'}} - +''' def list_teams(list_of_teams): for team in list_of_teams: print(str(team) + "\n") def add(): - Player_Add = input("Let's add a team! Choose any team.") + Player_Add = input("Let's add a team! Choose any team. ") if Player_Add.isalpha and Player_Add != None: - teams.append(Player_Add) + teams[Player_Add] = {} + # Add Number + num_question = str(input("Insert team Number ")) + teams[Player_Add]["Number"] = num_question + # Add name + name_question = input("Insert its name ") + teams[Player_Add]["Name"] = name_question + # Add Programming Language + lang_question = input("Insert Programming Language ") + teams[Player_Add]["Prog. Language"] = lang_question + # Add Width + wide_question = str(input("Insert robot width (In inches) ")) + teams[Player_Add]["Width"] = wide_question + # Add Length + long_question = str(input("Insert robot length (In inches) ")) + teams[Player_Add]["Length"] = long_question + # Add Cam Vision + cam_question = input("Insert Yes or No for Camera Vision on Robot ") + teams[Player_Add]["Camera Vision?"] = cam_question + # Add Drivetrain Motor Number + drive_question = str(input("Insert Number of Drivetrain Motors on robot ")) + teams[Player_Add]["Number of Drivetrain Motors"] = drive_question print(teams) def remove(): - Player_Delete = input("Let's see. What team do you want to delete?") + Player_Delete = input("Let's see. What team do you want to delete? ") if Player_Delete.isalpha and Player_Delete != None: if Player_Delete in teams: teams.remove(Player_Delete) @@ -36,18 +51,18 @@ def remove(): def view(): view_input = input("Whose data do you want to view?: ") team_information_input = input("What datapoint would you like to see?: ") - if view_input in Robot_Team_all and team_information_input in Robot_Team_all[view_input]: - print(Robot_Team_all[view_input][team_information_input]) + if view_input in teams and team_information_input in teams[view_input]: + print(teams[view_input][team_information_input]) else: print("Sorry. I don't think your value is in the data files. Make sure your values are strings and try again.") def modify(): modifier_team = input("\n Whose team's data would you like to modify?: ") modifier_datapoint = input("\nWhat datapoint would you like to modify?: ") - if modifier_team in Robot_Team_all and modifier_datapoint in Robot_Team_all[modifier_team]: - print("The current value for " + str(modifier_datapoint) + " of team " + str(modifier_team) + " is " + Robot_Team_all[modifier_team][modifier_datapoint]) + if modifier_team in teams: + print("The current value for " + str(modifier_datapoint) + " of team " + str(modifier_team) + " is " + teams[modifier_team][modifier_datapoint]) modifiee_datapoint = input("\nWhat value would you like to change it to?: ") - Robot_Team_all[modifier_team][modifier_datapoint] = modifiee_datapoint + teams[modifier_team][modifier_datapoint] = modifiee_datapoint print("The new value has been changed to: " + str(modifiee_datapoint)) else: print("Sorry. I'm afraid your input is not in the database. Try again") @@ -55,8 +70,8 @@ def modify(): def search(): search_team = input("Which team do you want to look for? ") name_team = input("What is the name of the team, for safety measures? ") - if search_team in Robot_Team_all and name_team in Robot_Team_all[search_team]['Name']: - print(str(search_team in Robot_Team_all)) + if search_team in teams and name_team in teams[search_team]['Name']: + print(str(search_team in teams)) else: print(False) From 3e06ff74eb7de1a3d7464610351f3c1c0bff4106 Mon Sep 17 00:00:00 2001 From: jonathanhoNumberXIII Date: Wed, 13 Nov 2019 15:42:26 -0800 Subject: [PATCH 13/17] Update 2.1.0 of Chapter 2 Added additional validations to the add function in case an input wasn't a number. Also made sure that the user typed yes or no in cam_question, or it resulted in them having to try again --- ch_2_assign_Jonathan_Ho.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/ch_2_assign_Jonathan_Ho.py b/ch_2_assign_Jonathan_Ho.py index 04ed720..eabec52 100644 --- a/ch_2_assign_Jonathan_Ho.py +++ b/ch_2_assign_Jonathan_Ho.py @@ -17,27 +17,30 @@ def add(): if Player_Add.isalpha and Player_Add != None: teams[Player_Add] = {} # Add Number - num_question = str(input("Insert team Number ")) - teams[Player_Add]["Number"] = num_question + num_question = input("Insert team Number ") # Add name name_question = input("Insert its name ") - teams[Player_Add]["Name"] = name_question # Add Programming Language lang_question = input("Insert Programming Language ") - teams[Player_Add]["Prog. Language"] = lang_question # Add Width - wide_question = str(input("Insert robot width (In inches) ")) - teams[Player_Add]["Width"] = wide_question + wide_question = input("Insert robot width (In inches) ") # Add Length - long_question = str(input("Insert robot length (In inches) ")) - teams[Player_Add]["Length"] = long_question + long_question = input("Insert robot length (In inches) ") # Add Cam Vision cam_question = input("Insert Yes or No for Camera Vision on Robot ") - teams[Player_Add]["Camera Vision?"] = cam_question # Add Drivetrain Motor Number - drive_question = str(input("Insert Number of Drivetrain Motors on robot ")) - teams[Player_Add]["Number of Drivetrain Motors"] = drive_question - print(teams) + drive_question = input("Insert Number of Drivetrain Motors on robot ") + if num_question.isdigit() and wide_question.isdigit() and long_question.isdigit() and drive_question.isdigit() and (cam_question == "Yes" or cam_question == "No"): + teams[Player_Add]["Number"] = str(num_question) + teams[Player_Add]["Name"] = name_question + teams[Player_Add]["Prog. Language"] = lang_question + teams[Player_Add]["Width"] = str(wide_question) + teams[Player_Add]["Length"] = str(long_question) + teams[Player_Add]["Camera Vision?"] = cam_question + teams[Player_Add]["Number of Drivetrain Motors"] = str(drive_question) + print(teams) + else: + print("Uh oh! One of your inputs was invalid. Make sure that the questions involving numbers are actually numbers, 'kay?") def remove(): Player_Delete = input("Let's see. What team do you want to delete? ") From adba7031353f5f0969ca2939de8542349566b67d Mon Sep 17 00:00:00 2001 From: jonathanhoNumberXIII Date: Wed, 13 Nov 2019 15:56:22 -0800 Subject: [PATCH 14/17] Update 2.1.1 of Chapter 2 Modified the remove function so it actually removes the element specified. The previous code had the remove function remove from a list, so I changed it to remove it from a dictionary --- ch_2_assign_Jonathan_Ho.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch_2_assign_Jonathan_Ho.py b/ch_2_assign_Jonathan_Ho.py index eabec52..61dd0d0 100644 --- a/ch_2_assign_Jonathan_Ho.py +++ b/ch_2_assign_Jonathan_Ho.py @@ -46,7 +46,7 @@ def remove(): Player_Delete = input("Let's see. What team do you want to delete? ") if Player_Delete.isalpha and Player_Delete != None: if Player_Delete in teams: - teams.remove(Player_Delete) + teams.pop(Player_Delete) print(teams) else: print("Sorry. That's not in the database. Try again.") From e5ba176508a95af84ad8b1c73b3c75f3fd80ab44 Mon Sep 17 00:00:00 2001 From: jonathanhoNumberXIII Date: Wed, 13 Nov 2019 16:32:29 -0800 Subject: [PATCH 15/17] Updated Chapter 4 Assignment 2.1.0 Chapter 4 assignment which now has the additional code that calculates whether the 2D or the 3D point is furthest from the origin, then prints out the farthest point. --- ch_4_assign_Jonathan_Ho.py | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/ch_4_assign_Jonathan_Ho.py b/ch_4_assign_Jonathan_Ho.py index 76b3416..14996bc 100644 --- a/ch_4_assign_Jonathan_Ho.py +++ b/ch_4_assign_Jonathan_Ho.py @@ -22,20 +22,17 @@ def Distance(self): hypo_2 = super().Distance() ** 2 + self.z ** 2 return sqrt(hypo_2) - while True: Operation = input("What type of dimension do you want to use for the Pythagorean Theorem? If you wish to leave, type 'exit'.") if Operation == "2D": x = input("Enter the first value of your first leg of your triangle.") y = input("Enter the second value of your next leg.") - # # Assure if x and y are integers if x.isdigit() and y.isdigit(): point = Point(x, y).Distance() print(point) else: print("Sorry, the variable is not a number. Try again.") - elif Operation == "3D": x = input("Enter the first value of the length of the side of your 3D rectangle.") @@ -47,10 +44,41 @@ def Distance(self): print(calc_3D_point) else: print("Sorry, your variable wasn't an integer. Try using a number.") + + # If the user wants to compare 2D and 3D points + elif Operation == "Origin": + # 2D + x = input("Enter the first value of your first leg of your triangle.") + y = input("Enter the second value of your next leg.") + # Assure if x and y are integers + if x.isdigit() and y.isdigit(): + point = Point(x, y) + print(point) + else: + print("Sorry, the variable is not a number. Try again.") + # 3D + x2 = input("Enter the first value of the length of the side of your 3D rectangle.") + y2 = input("Enter the next value of the second length of your 3D rectangle.") + z2 = input("Now enter the height of your 3D rectangle") + # Validates if the inputs are integers for the code to use the if statement + if x2.isdigit() and y2.isdigit() and z2.isdigit(): + calc_3D_point = Point_3D(x2, y2, z2) + print(calc_3D_point) + if point.Distance() > calc_3D_point.Distance(): + print("The point farthest from the origin is: (" + str(x) + ", " + str(y) + ").") + elif point.Distance() < calc_3D_point.Distance(): + print("The point farthest from the origin is: (" + str(x2) + ", " + str(y2) + ", " + str(z2) ").") + elif point.Distance() == calc_3D_point.Distance(): + print("My, my. The distance from the origin between those two coordinates are equal. How coincidential!") + else: + print("Oops! I didn't get that. Try again.") + else: + print("Sorry, your variable wasn't an integer. Try using a number.") + # If the user wishes to leave elif Operation == "exit": print("So long! Till we meet again.") break; # If the user types it incorrectly else: - print("Sorry. Your response wasn't valid. Try 3D or 2D.") + print("Sorry. Your response wasn't valid. Try 3D, 2D, or Origin.") From 398df4821ee7d4d2ed55b6352b2b621c77534a0b Mon Sep 17 00:00:00 2001 From: jonathanhoNumberXIII Date: Wed, 13 Nov 2019 19:06:17 -0800 Subject: [PATCH 16/17] Chapter 4 Version 2.1.1 (Updated) Fixed the syntax error. You can now check if the code works or not. --- ch_4_assign_Jonathan_Ho.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch_4_assign_Jonathan_Ho.py b/ch_4_assign_Jonathan_Ho.py index 14996bc..c8fabaa 100644 --- a/ch_4_assign_Jonathan_Ho.py +++ b/ch_4_assign_Jonathan_Ho.py @@ -67,7 +67,7 @@ def Distance(self): if point.Distance() > calc_3D_point.Distance(): print("The point farthest from the origin is: (" + str(x) + ", " + str(y) + ").") elif point.Distance() < calc_3D_point.Distance(): - print("The point farthest from the origin is: (" + str(x2) + ", " + str(y2) + ", " + str(z2) ").") + print("The point farthest from the origin is: (" + str(x2) + ", " + str(y2) + ", " + str(z2) + ").") elif point.Distance() == calc_3D_point.Distance(): print("My, my. The distance from the origin between those two coordinates are equal. How coincidential!") else: From 6ea7dabd7202fbe597171a4b4878e94b22421a94 Mon Sep 17 00:00:00 2001 From: jonathanhoNumberXIII Date: Wed, 13 Nov 2019 19:24:31 -0800 Subject: [PATCH 17/17] Update Chapter 2 Assignment Version 2.1.2 Removed the isalpha() method after figuring that the code can work without it. The use of it actually affects the code in a negative way. Also made the validations for the inputs in the add function. --- ch_2_assign_Jonathan_Ho.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ch_2_assign_Jonathan_Ho.py b/ch_2_assign_Jonathan_Ho.py index 61dd0d0..6f2665c 100644 --- a/ch_2_assign_Jonathan_Ho.py +++ b/ch_2_assign_Jonathan_Ho.py @@ -14,7 +14,7 @@ def list_teams(list_of_teams): def add(): Player_Add = input("Let's add a team! Choose any team. ") - if Player_Add.isalpha and Player_Add != None: + if Player_Add != None: teams[Player_Add] = {} # Add Number num_question = input("Insert team Number ") @@ -31,20 +31,21 @@ def add(): # Add Drivetrain Motor Number drive_question = input("Insert Number of Drivetrain Motors on robot ") if num_question.isdigit() and wide_question.isdigit() and long_question.isdigit() and drive_question.isdigit() and (cam_question == "Yes" or cam_question == "No"): - teams[Player_Add]["Number"] = str(num_question) + teams[Player_Add]["Number"] = num_question teams[Player_Add]["Name"] = name_question teams[Player_Add]["Prog. Language"] = lang_question - teams[Player_Add]["Width"] = str(wide_question) - teams[Player_Add]["Length"] = str(long_question) + teams[Player_Add]["Width"] = wide_question + teams[Player_Add]["Length"] = long_question teams[Player_Add]["Camera Vision?"] = cam_question - teams[Player_Add]["Number of Drivetrain Motors"] = str(drive_question) + teams[Player_Add]["Number of Drivetrain Motors"] = drive_question print(teams) else: print("Uh oh! One of your inputs was invalid. Make sure that the questions involving numbers are actually numbers, 'kay?") + teams.pop(Player_Add) def remove(): Player_Delete = input("Let's see. What team do you want to delete? ") - if Player_Delete.isalpha and Player_Delete != None: + if Player_Delete != None: if Player_Delete in teams: teams.pop(Player_Delete) print(teams)