diff --git a/ch_1_assign_alexandra_fomina.py b/ch_1_assign_alexandra_fomina.py new file mode 100644 index 0000000..b6836c1 --- /dev/null +++ b/ch_1_assign_alexandra_fomina.py @@ -0,0 +1,42 @@ +robot_information = { +#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, + 'comp_location' : 'Michigan', + 'awards' : [] + }, + 4 : { + 'location' : 'Van Nuys, California', + 'rookie_year' : '1997', + '2019_competition' : False, + 'comp_location' : 'Valencia, Los Angeles, Camarillo, San Pedro', + 'awards' : ['Quality'] + }, + 5 : { + 'location' : 'Melvindale, Michigan', + 'rookie_year' : '1998', + '2019_competition' : True, + 'comp_location' : 'Michigan', + 'awards' : [] + }, + 6 : { + 'location' : 'Plymouth, Minnesota', + 'rookie_year' : '1994', + '2019_competition' : False, + 'comp_location' : 'none', + 'awards' : [] + }, + 7 : { + 'location' : 'Baltimore Maryland', + 'rookie_year' : '1997', + '2019_competition' : False, + 'comp_location' : 'none', + 'awards' : [], + } +} +team_number = int(input("What is the team number? ")) +team_attribute = input("What is the team attribute? ") +print(robot_information[team_number] [team_attribute]) diff --git a/ch_2_assign_alexandra_fomina.py b/ch_2_assign_alexandra_fomina.py new file mode 100644 index 0000000..47f2769 --- /dev/null +++ b/ch_2_assign_alexandra_fomina.py @@ -0,0 +1,68 @@ +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 view to see a team's information + Type edit to edit a team's information + Type quit to exit + """) + 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 == "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) + if command == "quit": + break \ No newline at end of file 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');