Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
def0131
Add Hello World File
jonathanhoNumberXIII Sep 12, 2019
35eb316
I used the nests to store all of the data separately for each team, then
jonathanhoNumberXIII Sep 19, 2019
457a616
I placed the data of each robotics team into nests of dictionaries and
jonathanhoNumberXIII Sep 19, 2019
45d50fd
I changed the Dictionary code so it's now a nested Dictionary that
jonathanhoNumberXIII Sep 27, 2019
6772c2e
I simply deleted the larger portion of the code, and printed out a
jonathanhoNumberXIII Sep 27, 2019
e21d2fe
Update ch_1_assign_Jonathan_Ho.py
jonathanhoNumberXIII Sep 27, 2019
375ca3e
My code can add any team, by name or number, and remove them as well as
jonathanhoNumberXIII Oct 4, 2019
b5c00de
Merge branch 'master' of https://github.com/jonathanhoNumberXIII/soft…
jonathanhoNumberXIII Oct 4, 2019
1b64bf9
This assignment is a combination of the two before. I made a nested
jonathanhoNumberXIII Oct 11, 2019
913c086
This modified code allows the user to add, remove, view, modify, search,
jonathanhoNumberXIII Oct 17, 2019
8d28dac
In this bundle of code, I'm using the Pythagorean Theorem for
jonathanhoNumberXIII Oct 25, 2019
8f03d32
This code has been updated and modified to make sure that there are no
jonathanhoNumberXIII Oct 31, 2019
d29421e
Chapter 2 Assignment (Modified Again) This time, this code has only a
jonathanhoNumberXIII Nov 7, 2019
3e06ff7
Update 2.1.0 of Chapter 2
jonathanhoNumberXIII Nov 13, 2019
adba703
Update 2.1.1 of Chapter 2
jonathanhoNumberXIII Nov 13, 2019
e5ba176
Updated Chapter 4 Assignment 2.1.0
jonathanhoNumberXIII Nov 14, 2019
398df48
Chapter 4 Version 2.1.1 (Updated)
jonathanhoNumberXIII Nov 14, 2019
6ea7dab
Update Chapter 2 Assignment Version 2.1.2
jonathanhoNumberXIII Nov 14, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ch_1_Lesson_Jonathan_Ho_Welcome_Back.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello, World... again XD")
52 changes: 52 additions & 0 deletions ch_1_assign_Jonathan_Ho.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Robot_Team = int(input("What Robotics Team do you want to look into?"))
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',
'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'
,]},
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',
'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'
]},
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'
},
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])
101 changes: 101 additions & 0 deletions ch_2_assign_Jonathan_Ho.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
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. ")
if Player_Add != None:
teams[Player_Add] = {}
# Add Number
num_question = input("Insert team Number ")
# Add name
name_question = input("Insert its name ")
# Add Programming Language
lang_question = input("Insert Programming Language ")
# Add Width
wide_question = input("Insert robot width (In inches) ")
# Add Length
long_question = input("Insert robot length (In inches) ")
# Add Cam Vision
cam_question = input("Insert Yes or No for Camera Vision on Robot ")
# 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"] = num_question
teams[Player_Add]["Name"] = name_question
teams[Player_Add]["Prog. Language"] = lang_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"] = 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 != None:
if Player_Delete in teams:
teams.pop(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?: ")
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 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?: ")
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")

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 teams and name_team in teams[search_team]['Name']:
print(str(search_team in teams))
else:
print(False)


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":
print("Thanks for using this! See ya real soon!")
break;
else:
print("Sorry! I didn't get that! Please try again.")
120 changes: 120 additions & 0 deletions ch_3_assign_Jonathan_Ho.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
Team_Data = {'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_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.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.isdigit and Player_Delete != None:
Team_Data.pop(Player_Delete)

def view_info():
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? ")
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():
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_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
'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_Data)
elif Player_Control == 'quit':
print("Gotcha! See ya around!")
break;
else:
print("Sorry! Did you say something else? Your reply is not valid. Please try again! :)")
84 changes: 84 additions & 0 deletions ch_4_assign_Jonathan_Ho.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
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 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, 2D, or Origin.")