-
Notifications
You must be signed in to change notification settings - Fork 18
Emily Xia Assignment 1 #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
emxia18
wants to merge
26
commits into
frc1678:master
Choose a base branch
from
emxia18:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
2070698
add ch_1_lesson_emily_xia.py to repository
emxia18 01f5a75
Add files via upload
emxia18 d46025d
add ch_1_assign_emily_xia.py to repository
emxia18 0126076
Merge branch 'master' of https://github.com/emxia18/software-training
emxia18 0e42bc4
add lines 91-93 on ch_1_assign_emily_xia.py
emxia18 ee89495
edit lines 91-101
emxia18 6a1d829
combine two lists: "Names_of_Competition" and
emxia18 8fc0c84
write the code
emxia18 5c6ead9
add modified version of ch_2_assign_emily_xia.py
emxia18 1bdd0f1
add comments and improve code
emxia18 1fc36f4
add search function
emxia18 87aaf3a
add validation in search function
emxia18 1cc9abd
delete string, integer, etc from add part to prevent code from crashing~
emxia18 0a56a38
remove extra file
emxia18 dd81089
add modify function
emxia18 f88971f
write code, some validation still needed
emxia18 f29c1dc
add verification, does not take into account first dictionary as part of
emxia18 6363482
improve validation
emxia18 7678afb
write code
emxia18 fe5a080
remove ; from code
emxia18 75d28e7
improve code based on comment
emxia18 c98f5d0
improve code based on comments
emxia18 15e8f22
improve modify function
emxia18 2ff3943
add validation
emxia18 8355718
add validation
emxia18 525ff97
add validation
emxia18 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| teams_dictionary={ | ||
| 1678:{ | ||
| "Location":"Davis_CA", | ||
| "Rookie_year":2005, | ||
| "2019_Competition_Status":True, | ||
| "Names_of_Competions":[ | ||
| "Central_Valley_Regional", | ||
| "Sacramento_Regional", | ||
| "Aerospace_Valley_Regional", | ||
| "Carver_Division", | ||
| "Einstein_Field", | ||
| "RCC_Qianjiang_International_Robotics_Invitational", | ||
| "Chezy_Champs"], | ||
| "Competition_Location":[ | ||
| "Fresno_CA", | ||
| "Davis_CA", | ||
| "Lancaster_CA", | ||
| "Houston_TX", | ||
| "Houston_TX", | ||
| "Hangzhou_CN", | ||
| "San_Jose_CA"], | ||
| "Competition_Awards":[ | ||
| "Regional_Chairmans_Award", | ||
| "Regional_Winner", | ||
| "Deans_List", | ||
| "Regional_Winner", | ||
| "Industrial_Design_Award", | ||
| "Excellence_in_Engineering", | ||
| "Championship_Subdivision_Winner", | ||
| "Entrepreneurship-Award"]}, | ||
| 3132:{ | ||
| "Location":"Sydney_Australia", | ||
| "Rookie_year":2010, | ||
| "2019_Competition_Status":True, | ||
| "Names_of_Competions":[ | ||
| "Southern_Cross_Regional", | ||
| "South_Pacific_Regional", | ||
| "Carver_Division", | ||
| "Einstein_Field"], | ||
| "Competition_Location":[ | ||
| "Sydeny_Olympic_Park", | ||
| "Sydeny_Olympic_Park", | ||
| "Houston_TX", | ||
| "Houston_TX"], | ||
| "Competition_Awards":[ | ||
| "Woodie_Flowers", | ||
| "Gracious_Professionalism", | ||
| "Regional_Engineering_Inspiration", | ||
| "Safety_Award"]}, | ||
| 1902:{ | ||
| "Location":"Orlando_FL", | ||
| "Rookie_year":2006, | ||
| "2019_Competition_Status":True, | ||
| "Names_of_Competions":[ | ||
| "Palmetto_Regional", | ||
| "Orlando_Regional", | ||
| "Newton_Division", | ||
| "Einstein_Field"], | ||
| "Competition_Location":[ | ||
| "Myrtle_Beach", | ||
| "Orlando_FL", | ||
| "Houston_TX", | ||
| "Houston_TX"], | ||
| "Competition_Awards":[ | ||
| "Regional_Chairmans_Award", | ||
| "Deans_List", | ||
| "Entrepreneurship-Award", | ||
| "Chairmans_Award_Finalist"]}, | ||
| 5458:{ | ||
| "Location":"Woodland_CA", | ||
| "Rookie_year":2015, | ||
| "2019_Competition_Status":True, | ||
| "Names_of_Competions":[ | ||
| "Central_Valley_Regional", | ||
| "Sacramento_Regional"], | ||
| "Competition_Location":[ | ||
| "Fresno_CA", | ||
| "Davis_CA"], | ||
| "Competition_Awards":[ | ||
| "None"]}, | ||
| 6174:{ | ||
| "Location":"Winters_CA", | ||
| "Rookie_year":2016, | ||
| "2019_Competition_Status":True, | ||
| "Names_of_Competions":[ | ||
| "Sacramento_Regional"], | ||
| "Competition_Location":[ | ||
| "Davis_CA"], | ||
| "Competition_Awards":[ | ||
| "None"]}} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| teams_dictionary={ | ||
| 1678:{ | ||
| "Location":"Davis_CA", | ||
| "Rookie_year":2005, | ||
| "2019_Competition_Status":True, | ||
| "Names_of_Competions":[ | ||
| "Central_Valley_Regional", | ||
| "Sacramento_Regional", | ||
| "Aerospace_Valley_Regional", | ||
| "Carver_Division", | ||
| "Einstein_Field", | ||
| "RCC_Qianjiang_International_Robotics_Invitational", | ||
| "Chezy_Champs"], | ||
| "Competition_Location":[ | ||
| "Fresno_CA", | ||
| "Davis_CA", | ||
| "Lancaster_CA", | ||
| "Houston_TX", | ||
| "Houston_TX", | ||
| "Hangzhou_CN", | ||
| "San_Jose_CA"], | ||
| "Competition_Awards":[ | ||
| "Regional_Chairmans_Award", | ||
| "Regional_Winner", | ||
| "Deans_List", | ||
| "Regional_Winner", | ||
| "Industrial_Design_Award", | ||
| "Excellence_in_Engineering", | ||
| "Championship_Subdivision_Winner", | ||
| "Entrepreneurship-Award"]}, | ||
| 3132:{ | ||
| "Location":"Sydney_Australia", | ||
| "Rookie_year":2010, | ||
| "2019_Competition_Status":True, | ||
| "Names_of_Competions":[ | ||
| "Southern_Cross_Regional", | ||
| "South_Pacific_Regional", | ||
| "Carver_Division", | ||
| "Einstein_Field"], | ||
| "Competition_Location":[ | ||
| "Sydeny_Olympic_Park", | ||
| "Sydeny_Olympic_Park", | ||
| "Houston_TX", | ||
| "Houston_TX"], | ||
| "Competition_Awards":[ | ||
| "Woodie_Flowers", | ||
| "Gracious_Professionalism", | ||
| "Regional_Engineering_Inspiration", | ||
| "Safety_Award"]}, | ||
| 1902:{ | ||
| "Location":"Orlando_FL", | ||
| "Rookie_year":2006, | ||
| "2019_Competition_Status":True, | ||
| "Names_of_Competions":[ | ||
| "Palmetto_Regional", | ||
| "Orlando_Regional", | ||
| "Newton_Division", | ||
| "Einstein_Field"], | ||
| "Competition_Location":[ | ||
| "Myrtle_Beach", | ||
| "Orlando_FL", | ||
| "Houston_TX", | ||
| "Houston_TX"], | ||
| "Competition_Awards":[ | ||
| "Regional_Chairmans_Award", | ||
| "Deans_List", | ||
| "Entrepreneurship-Award", | ||
| "Chairmans_Award_Finalist"]}, | ||
| 5458:{ | ||
| "Location":"Woodland_CA", | ||
| "Rookie_year":2015, | ||
| "2019_Competition_Status":True, | ||
| "Names_of_Competions":[ | ||
| "Central_Valley_Regional", | ||
| "Sacramento_Regional"], | ||
| "Competition_Location":[ | ||
| "Fresno_CA", | ||
| "Davis_CA"], | ||
| "Competition_Awards":[ | ||
| "None"]}, | ||
| 6174:{ | ||
| "Location":"Winters_CA", | ||
| "Rookie_year":2016, | ||
| "2019_Competition_Status":True, | ||
| "Names_of_Competions":[ | ||
| "Sacramento_Regional"], | ||
| "Competition_Location":[ | ||
| "Davis_CA"], | ||
| "Competition_Awards":[ | ||
| "None"]}} | ||
| team_number = int(input("Out of 1678, 3132, 1902, 5458, and 6174, what is the number of the desired team?")) | ||
| team_attribute = str(input( | ||
| """Out of: | ||
| Location, | ||
| Rookie_year, | ||
| 2019_Competition_Status, | ||
| Names_of_Competitions, | ||
| Competition_Locations, | ||
| Competition_Awards | ||
| what is the desired attribute?""")) | ||
| print(teams_dictionary[team_number][team_attribute]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| print ('Hello, world') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,167 @@ | ||
| team_dictionary = {} | ||
| user_action = input("""Enter the number of the action you want to do | ||
| 1 add a team | ||
| 2 modify a team | ||
| 3 view a team | ||
| 4 remove a team | ||
| 5 search a team | ||
| 6 list all teams | ||
| 7 leave \n """) | ||
| while True: | ||
| if user_action == "0": | ||
| #returning to main menu | ||
| user_action = input("""Enter the number of the action you want to do | ||
| 1 add a team | ||
| 2 modify a team | ||
| 3 view a team | ||
| 4 remove a team | ||
| 5 search a team | ||
| 6 list all teams | ||
| 7 leave \n """) | ||
| elif user_action == "1": | ||
| #adding a team | ||
| number = input("What is your team number? \n") | ||
| while number.isdigit() == False: | ||
| number = input("Your input is not an integer, please input an integer \n") | ||
| name = input("What is the name of your team? \n") | ||
| while name.isdigit() == True: | ||
| name = input("Your input is not a string, please input a string\n") | ||
| programming_language = input("What is the programming language of your team? \n") | ||
| while programming_language.isdigit() == True: | ||
| programming_language = input("Your input is not a string, please input a string\n") | ||
| width = input("What is the width of your robot? \n") | ||
| while width.isdigit() == False: | ||
| width = input("Your input is not an integer, please input an integer \n") | ||
| length = input("What is the length of your robot? \n") | ||
| while length.isdigit() == False: | ||
| length = input("Your input is not an integer, please input an integer \n") | ||
| camera_vision_system = input("True or False, your robot has a camera vision system? \n") | ||
| while True: | ||
| if camera_vision_system != "True": | ||
| if camera_vision_system != "False": | ||
| camera_vision_system = input("Your input is not a boolean, please input either 'True' or 'False' \n") | ||
| if camera_vision_system == "True": | ||
| break | ||
| elif camera_vision_system == "False": | ||
| break | ||
| else: | ||
| break | ||
| else: | ||
| break | ||
| number_of_motors = input("How many motors does your robot have? \n") | ||
| while number_of_motors.isdigit() == False: | ||
| number_of_motors = input("Your input is not an integer, please input an integer \n") | ||
| added_team_information = { | ||
| "number": number, | ||
| "name": name, | ||
| "programming_language": programming_language, | ||
| "width": width, | ||
| "length": length, | ||
| "camera_vision_system": camera_vision_system, | ||
| "number_of_motors": number_of_motors} | ||
| team_dictionary.update({number:added_team_information}) | ||
| user_action = input("""If you want to continue, press 1. \nIf you want to exit the "add" function, press 0. \n """) | ||
| elif user_action == "2": | ||
| #modify a team | ||
| modify_team = input("What is the team you want to modify? \n") | ||
| modify_attribute = None | ||
| new_attribute = None | ||
| if modify_team in team_dictionary: | ||
| print(team_dictionary[modify_team]) | ||
| modify_attribute = input("What is the attribute that you want to modify? \n") | ||
| if modify_attribute in team_dictionary[modify_team]: | ||
| new_attribute = input("What do you want the new "+modify_attribute+" to be? \n") | ||
| if modify_attribute == "number": | ||
| while new_attribute.isdigit() == False: | ||
| new_attribute = input("Your input is not an integer, please input a integer\n") | ||
| elif modify_attribute == "name": | ||
| while new_attribute.isdigit() == True: | ||
| new_attribute = input("Your input is not a string, please input a string\n") | ||
| elif modify_attribute == "programming_language": | ||
| while new_attribute.isdigit() == True: | ||
| new_attribute = input("Your input is not a string, please input a string\n") | ||
| elif modify_attribute == "width": | ||
| while new_attribute.isdigit() == False: | ||
| new_attribute = input("Your input is not an integer, please input a integer\n") | ||
| elif modify_attribute == "length": | ||
| while new_attribute.isdigit() == False: | ||
| new_attribute = input("Your input is not an integer, please input a integer\n") | ||
| elif modify_attribute == "camera_vision_system": | ||
| while True: | ||
| if new_attribute != "True": | ||
| if new_attribute != "False": | ||
| new_attribute = input("Your input is not a boolean, please input either 'True' or 'False' \n") | ||
| if new_attribute == "True": | ||
| break | ||
| elif new_attribute == "False": | ||
| break | ||
| else: | ||
| break | ||
| else: | ||
| break | ||
| elif modify_attribute == "number_of_motors": | ||
| while new_attribute.isdigit() == False: | ||
| new_attribute = input("Your input is not an integer, please input a integer\n") | ||
| team_dictionary[modify_team].update({modify_attribute:new_attribute}) | ||
| print(team_dictionary[modify_team]) | ||
| user_action = input("""If you want to continue, press 2. \nIf you want to exit the "modify" function, press 0. \n""") | ||
| if modify_attribute == "number": | ||
| team_dictionary[new_attribute] = team_dictionary[modify_team] | ||
| team_dictionary.pop(modify_team) | ||
| elif modify_team not in team_dictionary[modify_team]: | ||
| print("I'm sorry, the team you want to modify is not in the dictionary.") | ||
| user_action = input("""If you want to continue, press 2. \nIf you want to exit the "modify" function, press 0. \n""") | ||
| elif modify_team not in team_dictionary: | ||
| print("I'm sorry, the team you want to modify is not in the dictionary.") | ||
| user_action = input("""If you want to continue, press 2. \nIf you want to exit the "modify" function, press 0. \n""") | ||
| elif user_action == "3": | ||
| #viewing a team | ||
| view_team = input("What is the number of the team you want to view? \n ") | ||
| if view_team in team_dictionary: | ||
| print(team_dictionary[view_team]) | ||
| elif view_team not in team_dictionary: | ||
| print("I'm sorry, the team you are looking for does not exist.") | ||
| user_action = input("""If you want to continue, press 3. \nIf you want to exit the "view" function, press 0. \n """) | ||
| elif user_action == "4": | ||
| #removing a team | ||
| print(team_dictionary) | ||
| remove_team = input("What is the number of the team you want to remove? \n ") | ||
| if remove_team in team_dictionary: | ||
| team_dictionary.pop(remove_team) | ||
| print("Team " +remove_team+ " has been removed from the team dictionary!") | ||
| elif remove_team not in team_dictionary: | ||
| print("I'm sorry, the team you are looking for does not exist.") | ||
| user_action = input("""If you want to continue, press 4. \nIf you want to exit the "remove" function, press 0.\n """) | ||
| elif user_action == "5": | ||
| #searching for a team | ||
| search_team = input("What is the number or name of the team you want to search for?\n") | ||
| if search_team in team_dictionary: | ||
| print("Yes, the team you are looking for is in the team dictionary") | ||
| else: | ||
| result=None | ||
| for key in team_dictionary: | ||
| if team_dictionary[key]["name"] == search_team: | ||
| print("Yes, the team you are looking for is in the team dictionary") | ||
| result=team_dictionary[key] | ||
| break | ||
| if not result: | ||
| print("""I'm sorry, but the team you are looking for is not in the team dictionary. | ||
| Please make sure that your input is an integer.""") | ||
| user_action = input("""If you want to continue, press 5. \n If you want to exit the "search" function, press 0.\n """) | ||
| elif user_action == "6": | ||
| #listing all teams | ||
| print(team_dictionary) | ||
| user_action = input("""If you want to continue, press 6. \nIf you want to exit the "list" function, press 0.\n """) | ||
| elif user_action not in ["0", "1", "2", "3", "4", "5", "6", "7"]: | ||
| #returning to main menu if user_action is not a known value | ||
| print("I'm sorry, could you please re-enter your command?") | ||
| user_action = input("""Enter the number of the action you want to do | ||
| 1 add a team | ||
| 2 modify a team | ||
| 3 view a team | ||
| 4 remove a team | ||
| 5 search a team | ||
| 6 list all teams | ||
| 7 leave \n""") | ||
| elif user_action == "7": | ||
| break |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to ask for user input to retrieve a piece of information about a specific team. Right now, this is just a dictionary that does nothing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, got it. Thanks! I will try to work on that when I have time. If I have any questions, should I ask them via slack or can I ask them here? Thanks!!