From 6b8199a252b4dcde454f132f56e60d7fb4494ba0 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Wed, 11 Sep 2019 20:00:46 -0700 Subject: [PATCH 1/7] Add --- filename.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 filename.py diff --git a/filename.py b/filename.py new file mode 100644 index 0000000..e85f512 --- /dev/null +++ b/filename.py @@ -0,0 +1 @@ +print('hello world'); From adc22d343b5efde8dc71e6b806ee027cb0d5c263 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Thu, 12 Sep 2019 20:49:39 -0700 Subject: [PATCH 2/7] Add ch_1_assign_alexandra_fomina.py to repository. --- ch_1_assign_alexandra_fomina.py | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 ch_1_assign_alexandra_fomina.py diff --git a/ch_1_assign_alexandra_fomina.py b/ch_1_assign_alexandra_fomina.py new file mode 100644 index 0000000..bdd7e05 --- /dev/null +++ b/ch_1_assign_alexandra_fomina.py @@ -0,0 +1,40 @@ +robot_information = { + 'one' : { + 'location': 'Pontiac, Michigan', + 'rookie_year' : '1997' , + '2019_competition' : 'true', + 'comp_location' : 'Michigan', + 'awards' : 'none' + }, + 'four' : { + 'location' : 'Van Nuys, California', + 'rookie_year' : '1997', + '2019_competition' : 'true', + 'comp_location' : 'Valencia, Los Angeles, Camarillo, San Pedro', + 'awards' : 'Quality' + }, + 'five' : { + 'location' : 'Melvindale, Michigan', + 'rookie_year' : '1998', + '2019_competition' : 'true', + 'comp_location' : 'Michigan', + 'awards' : 'none' + }, + 'six' : { + 'location' : 'Plymouth, Minnesota', + 'rookie_year' : '1994', + '2019_competition' : 'false', + 'comp_location' : 'none', + 'awards' : 'none' + }, + 'seven' : { + 'location' : 'Baltimore Maryland', + 'rookie_year' : '1997', + '2019_competition' : 'none', + 'comp_location' : 'none', + 'awards' : 'none', + } +} +team_number = input("What is the team number? ") +team_attribute = input("What is the team attribute? ") +print(robot_information[team_number] [team_attribute]) From 5e264726cb9fb5c35a5490163e8fb9c89f919b50 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Wed, 18 Sep 2019 19:25:17 -0700 Subject: [PATCH 3/7] Add spaces --- ch_1_assign_alexandra_fomina.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ch_1_assign_alexandra_fomina.py b/ch_1_assign_alexandra_fomina.py index bdd7e05..7b4cee6 100644 --- a/ch_1_assign_alexandra_fomina.py +++ b/ch_1_assign_alexandra_fomina.py @@ -5,35 +5,35 @@ '2019_competition' : 'true', 'comp_location' : 'Michigan', 'awards' : 'none' - }, + }, 'four' : { 'location' : 'Van Nuys, California', 'rookie_year' : '1997', '2019_competition' : 'true', 'comp_location' : 'Valencia, Los Angeles, Camarillo, San Pedro', 'awards' : 'Quality' - }, + }, 'five' : { 'location' : 'Melvindale, Michigan', 'rookie_year' : '1998', '2019_competition' : 'true', 'comp_location' : 'Michigan', 'awards' : 'none' - }, + }, 'six' : { 'location' : 'Plymouth, Minnesota', 'rookie_year' : '1994', '2019_competition' : 'false', 'comp_location' : 'none', 'awards' : 'none' - }, - 'seven' : { + }, + 'seven' : { 'location' : 'Baltimore Maryland', 'rookie_year' : '1997', '2019_competition' : 'none', 'comp_location' : 'none', 'awards' : 'none', - } + } } team_number = input("What is the team number? ") team_attribute = input("What is the team attribute? ") From b6c68fe94f6421fdf73a0ad03a2376eeaacabf0b Mon Sep 17 00:00:00 2001 From: Alexandra Date: Thu, 19 Sep 2019 20:32:54 -0700 Subject: [PATCH 4/7] Chapter 2 Assign. --- ch_2_assign_alexandra_fomina.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 ch_2_assign_alexandra_fomina.py diff --git a/ch_2_assign_alexandra_fomina.py b/ch_2_assign_alexandra_fomina.py new file mode 100644 index 0000000..7afe9cb --- /dev/null +++ b/ch_2_assign_alexandra_fomina.py @@ -0,0 +1,16 @@ +teams = {} +while True: + command = input(""" Type add to add a team, + Type remove to remove a team, + Type search to search for a team, + Type list all teams to display all teams, + Type quit to exit + """) + if command == "add" : + add = input("What is the team number?") + teams[add] = {} + + if command == quit + break +#print (""" Type 'add' to add a team +#Type 'information' to see team's information) \ No newline at end of file From 81d156e928b25eb32344ad25e81b0f000f1a95fb Mon Sep 17 00:00:00 2001 From: Alexandra Date: Wed, 25 Sep 2019 19:06:12 -0700 Subject: [PATCH 5/7] Created a boolean and added a list --- ch_1_assign_alexandra_fomina.py | 34 +++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/ch_1_assign_alexandra_fomina.py b/ch_1_assign_alexandra_fomina.py index 7b4cee6..b6836c1 100644 --- a/ch_1_assign_alexandra_fomina.py +++ b/ch_1_assign_alexandra_fomina.py @@ -1,40 +1,42 @@ robot_information = { - 'one' : { +#I'm using a dictionary because it allows to give variables a key +#I created a list for awards in case thaqt there are more awards to add later on + 1 : { 'location': 'Pontiac, Michigan', 'rookie_year' : '1997' , - '2019_competition' : 'true', + '2019_competition' : True, 'comp_location' : 'Michigan', - 'awards' : 'none' + 'awards' : [] }, - 'four' : { + 4 : { 'location' : 'Van Nuys, California', 'rookie_year' : '1997', - '2019_competition' : 'true', + '2019_competition' : False, 'comp_location' : 'Valencia, Los Angeles, Camarillo, San Pedro', - 'awards' : 'Quality' + 'awards' : ['Quality'] }, - 'five' : { + 5 : { 'location' : 'Melvindale, Michigan', 'rookie_year' : '1998', - '2019_competition' : 'true', + '2019_competition' : True, 'comp_location' : 'Michigan', - 'awards' : 'none' + 'awards' : [] }, - 'six' : { + 6 : { 'location' : 'Plymouth, Minnesota', 'rookie_year' : '1994', - '2019_competition' : 'false', + '2019_competition' : False, 'comp_location' : 'none', - 'awards' : 'none' + 'awards' : [] }, - 'seven' : { + 7 : { 'location' : 'Baltimore Maryland', 'rookie_year' : '1997', - '2019_competition' : 'none', + '2019_competition' : False, 'comp_location' : 'none', - 'awards' : 'none', + 'awards' : [], } } -team_number = input("What is the team number? ") +team_number = int(input("What is the team number? ")) team_attribute = input("What is the team attribute? ") print(robot_information[team_number] [team_attribute]) From 14a960d8ccf18a0f0f709252e4f885eb4ed0481f Mon Sep 17 00:00:00 2001 From: Alexandra Date: Tue, 1 Oct 2019 17:50:53 -0700 Subject: [PATCH 6/7] Initial draft --- ch_2_assign_alexandra_fomina.py | 77 ++++++++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 12 deletions(-) diff --git a/ch_2_assign_alexandra_fomina.py b/ch_2_assign_alexandra_fomina.py index 7afe9cb..058bf43 100644 --- a/ch_2_assign_alexandra_fomina.py +++ b/ch_2_assign_alexandra_fomina.py @@ -1,16 +1,69 @@ -teams = {} +teams = { + '': {} +} while True: - command = input(""" Type add to add a team, + command = input(""" + Type add to add a team, Type remove to remove a team, - Type search to search for a team, - Type list all teams to display all teams, + Type search to search for a team, + Type list all teams to display all teams, + Type view to see a team's information + Type edit to edit a team's information Type quit to exit """) - if command == "add" : - add = input("What is the team number?") - teams[add] = {} - - if command == quit - break -#print (""" Type 'add' to add a team -#Type 'information' to see team's information) \ No newline at end of file + if command == "add": + t_number = int(input("What is the team number?")) + t_name = input("What is the team name? ") + t_lang = input("What is their programming language? ") + t_width = float(input("What is the width of their robot? ")) + t_length = float(input("What is the length of their robot? ")) + t_camera = bool(input("Do they have camera vision?")) + t_motors = int(input("How many motors do they have? ")) + attributes = { + "Name" : t_name, + "Language" : t_lang, + "Width" : t_width, + "Length" : t_length, + "Camera" : t_camera , + "Motors" : t_motors + } + new_t = {t_number: attributes} + teams.update(new_t) + if command == "remove": + remove = int(input("What team would you like to remove?")) + teams[remove] = {} + print("That team has been removed") + if command == "search": + search = bool(input("Are you searching by number?" )) + if search == True: + number = input("What is the team number?") + if number in teams: + print(teams) + if search == False: + print("Please serach by team number!") + else: + print("This team doesn't exist") + if command == "list": + print(teams) + if command == "view": + view = int(input("Which team would you like to view? ")) + if view in teams: + print(teams[1678]) + else: + print("This team doesn't have any information") + if command == "quit": + break + if command == "edit": + new_name = input("What is the team name? ") + new_lang = input("What is their programming language? ") + new_width = float(input("What is the width of their robot? ")) + new_length = float(input("What is the length of their robot? ")) + new_camera = bool(input("Do they have camera vision?")) + new_motors = int(input("How many motors do they have? ")) + def replace_new_info(key_to_find, definition): + for key in teams.keys(): + if key == key_to_find: + teams[key] = new_name + replace_new_info('teams', 't_number') + print(t_number) + \ No newline at end of file From a197ea447d03688e81cd803aadbe1f62d007fda0 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Tue, 1 Oct 2019 20:03:49 -0700 Subject: [PATCH 7/7] Cleaned up code --- ch_2_assign_alexandra_fomina.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ch_2_assign_alexandra_fomina.py b/ch_2_assign_alexandra_fomina.py index 058bf43..47f2769 100644 --- a/ch_2_assign_alexandra_fomina.py +++ b/ch_2_assign_alexandra_fomina.py @@ -51,8 +51,6 @@ print(teams[1678]) else: print("This team doesn't have any information") - if command == "quit": - break if command == "edit": new_name = input("What is the team name? ") new_lang = input("What is their programming language? ") @@ -66,4 +64,5 @@ def replace_new_info(key_to_find, definition): teams[key] = new_name replace_new_info('teams', 't_number') print(t_number) - \ No newline at end of file + if command == "quit": + break \ No newline at end of file