diff --git a/Helloworld.py b/Helloworld.py new file mode 100644 index 0000000..44159b3 --- /dev/null +++ b/Helloworld.py @@ -0,0 +1 @@ +print("Hello world") diff --git a/Homework#1 b/Homework#1 new file mode 100644 index 0000000..e69de29 diff --git a/Homework#1.py b/Homework#1.py new file mode 100644 index 0000000..d7bd4df --- /dev/null +++ b/Homework#1.py @@ -0,0 +1,2 @@ +Robots={'1678':{'Weight':'100','Height':'150','Length':'200'}'127':{'Weight':'250','Height':'300','Length':'350'}} +print(Robots['1678']['Weight']) \ No newline at end of file diff --git a/ch-1_assign_lucca_braudagan.py b/ch-1_assign_lucca_braudagan.py new file mode 100644 index 0000000..08f913a --- /dev/null +++ b/ch-1_assign_lucca_braudagan.py @@ -0,0 +1,78 @@ +teams = { + 1678 : { + "team_name" : "Citrus Circuits", + "location" : "Davis, CA", + "rookie_year" : 2005, + "competed_in_2019_season" : True, + "2019_competition_names_and_locations" : { + "Central Valley Regional" : "Fresno, CA", + "Sacramento Regional" : "Davis, CA", + "Aerospace Valley Regional" : "Lancaster, CA", + "Carver Division" : "Houston, TX", + "Einstein Field" : "Houston, TX", + "RCC Qianjiang International Robotics Invitational" : "Hangzhou, Zhejiang, China", + "Chezy Champs" : "San Jose, CA" + }, + "2019_season_awards" : [ + "Regional Chairman's Award At Central Valley Regional", + "Regional Winners At Central Valley Regional", + "FIRST Dean's List Finalist Award", + "Regional Winners At Sacramento Regional", + "Industrial Design Award Sponsored By General Motors", + "Regional Winners At Aerospace Valley Regional", + "Excellence In Engineering Award Sponsered By Delphi", + "Championship Subdivision Winner In Carver Divison", + "Entrepreneurship Award Sponsored By Kleiner Perkins Caufield And Byers"] + }, + 4322 : { + "team_name" : "Clockwork Oranges", + "location" : "Orange, CA", + "rookie_year" : 2012, + "competed_in_2019_season" : True, + "2019_competition_names_and_locations" : { + "San Diego Regional Presented By Qualcomm" : "Del Mar, CA", + "Las Vegas Regional" : "Las Vegas, NV", + "Einstein Field" : "Houston, TX", + "Battleship Blast Monday" : "San Pedro, CA", + "Beach Blitz" : "Huntington Beach, CA" + }, + "2019_season_awards" : [ + "FIRST Dean's List Finalist Award", + "FIRST Dean's List Award"] + }, + 5458 : { + "team_name" : "Digital Minds", + "location" : "Woodland, CA", + "rookie_year" : 2015, + "competed_in_2019_season" : True, + "2019_competition_names_and_locations" : { + "Central Valley Regional" : "Fresno, CA", + "Sacramento Regional" : "Davis, CA" + }, + "2019_season_awards" : "None" + }, + 1 : { + "team_name" : "The Juggernauts", + "location" : "Pontiac, MI", + "rookie_year" : 1997, + "competed_in_2019_season" : True, + "2019_competition_names_and_locations" : { + "FIM District Center Line Event" : "Center Line, MI", + "FIM District Troy Event" : "Troy, MI" + }, + "2019_season_awards":"Imagery Award In Honor Of Jack Kamen" + }, + 7229 : { + "team_name" : "Electronic Eagles", + "location" : "Sacramento, CA", + "rookie_year" : 2018, + "competed_in_2019_season" : True, + "2019_competition_names_and_locations" : { + "Sacramento Regional" : "Davis, CA" + }, + "2019_season_awards" : "None" + } +} +team_number = int (input("Team Number (options are '1', '1678', '4322', '5458', '7229'):")) +team_information = input("Category (options are 'team_name', 'location', 'rookie_year', 'competed_in_2019_season','2019_competition_names_and_locations', '2019_season_awards':") +print(teams[team_number][team_information]) \ No newline at end of file diff --git a/ch_1_assign_lucca_braudagan.py b/ch_1_assign_lucca_braudagan.py new file mode 100644 index 0000000..08f913a --- /dev/null +++ b/ch_1_assign_lucca_braudagan.py @@ -0,0 +1,78 @@ +teams = { + 1678 : { + "team_name" : "Citrus Circuits", + "location" : "Davis, CA", + "rookie_year" : 2005, + "competed_in_2019_season" : True, + "2019_competition_names_and_locations" : { + "Central Valley Regional" : "Fresno, CA", + "Sacramento Regional" : "Davis, CA", + "Aerospace Valley Regional" : "Lancaster, CA", + "Carver Division" : "Houston, TX", + "Einstein Field" : "Houston, TX", + "RCC Qianjiang International Robotics Invitational" : "Hangzhou, Zhejiang, China", + "Chezy Champs" : "San Jose, CA" + }, + "2019_season_awards" : [ + "Regional Chairman's Award At Central Valley Regional", + "Regional Winners At Central Valley Regional", + "FIRST Dean's List Finalist Award", + "Regional Winners At Sacramento Regional", + "Industrial Design Award Sponsored By General Motors", + "Regional Winners At Aerospace Valley Regional", + "Excellence In Engineering Award Sponsered By Delphi", + "Championship Subdivision Winner In Carver Divison", + "Entrepreneurship Award Sponsored By Kleiner Perkins Caufield And Byers"] + }, + 4322 : { + "team_name" : "Clockwork Oranges", + "location" : "Orange, CA", + "rookie_year" : 2012, + "competed_in_2019_season" : True, + "2019_competition_names_and_locations" : { + "San Diego Regional Presented By Qualcomm" : "Del Mar, CA", + "Las Vegas Regional" : "Las Vegas, NV", + "Einstein Field" : "Houston, TX", + "Battleship Blast Monday" : "San Pedro, CA", + "Beach Blitz" : "Huntington Beach, CA" + }, + "2019_season_awards" : [ + "FIRST Dean's List Finalist Award", + "FIRST Dean's List Award"] + }, + 5458 : { + "team_name" : "Digital Minds", + "location" : "Woodland, CA", + "rookie_year" : 2015, + "competed_in_2019_season" : True, + "2019_competition_names_and_locations" : { + "Central Valley Regional" : "Fresno, CA", + "Sacramento Regional" : "Davis, CA" + }, + "2019_season_awards" : "None" + }, + 1 : { + "team_name" : "The Juggernauts", + "location" : "Pontiac, MI", + "rookie_year" : 1997, + "competed_in_2019_season" : True, + "2019_competition_names_and_locations" : { + "FIM District Center Line Event" : "Center Line, MI", + "FIM District Troy Event" : "Troy, MI" + }, + "2019_season_awards":"Imagery Award In Honor Of Jack Kamen" + }, + 7229 : { + "team_name" : "Electronic Eagles", + "location" : "Sacramento, CA", + "rookie_year" : 2018, + "competed_in_2019_season" : True, + "2019_competition_names_and_locations" : { + "Sacramento Regional" : "Davis, CA" + }, + "2019_season_awards" : "None" + } +} +team_number = int (input("Team Number (options are '1', '1678', '4322', '5458', '7229'):")) +team_information = input("Category (options are 'team_name', 'location', 'rookie_year', 'competed_in_2019_season','2019_competition_names_and_locations', '2019_season_awards':") +print(teams[team_number][team_information]) \ No newline at end of file diff --git a/ch_2_assign_lucca_braudagan.py b/ch_2_assign_lucca_braudagan.py new file mode 100644 index 0000000..cb455ad --- /dev/null +++ b/ch_2_assign_lucca_braudagan.py @@ -0,0 +1,102 @@ +def int_check(user_input): + while True: + if user_input.isdigit(): + return(int(user_input)) + else: + user_input = input("This is not a numeral value for your input. Try again. ") + +def bool_check(user_input): + while True: + if user_input.upper() == "TRUE": + return(True) + elif user_input.upper() == "FALSE": + return(False) + else: + user_input = input("This is not a boolean value for your input. Try again. (Input 'True' or 'False') ") + +teams = {} + +while True: + initial_user_request = input("Choose from: 'add' 'view_or_modify' 'remove' 'search' 'list' ") + if initial_user_request == "add": + temp_team_dictionary = {} + + team_number = input("What is your team's team number? ") + team_number = int_check(team_number) + + temp_team_dictionary["team_name"] = input("What is your team's name? ") + temp_team_dictionary["robot_name"] = input("What is your robot's name? ") + temp_team_dictionary["robot_p_language"] = input("What is your robot's programming language? ") + robot_width = input("What is your robot's width? ") + temp_team_dictionary["robot_width"] = int_check(robot_width) + robot_height = input("What is your robot's height? ") + temp_team_dictionary["robot_height"] = int_check(robot_height) + robot_camera = input("Does your robot have a camera vision system? (Input 'True' or 'False') ") + temp_team_dictionary["robot_camera"] = bool_check(robot_camera) + robot_drivetrain = input("How many drivetrain motors does your robot have? ") + temp_team_dictionary["robot_drivetrain"] = int_check(robot_drivetrain) + + teams[team_number] = temp_team_dictionary + + elif initial_user_request == "view_or_modify": + team_view_uncheck = input("Which team would you like to view? ") + team_view = int_check(team_view_uncheck) + + if team_view in teams: + information_category = input("What category would you like to view or modify? ") + integer_inputs = ["robot_width", "robot_height", "robot_drivetrain"] + if information_category in teams[team_view]: + if information_category in integer_inputs: + print(teams[team_view][information_category]) + new_info_uncheck = input("What would you like to change this value to? ") + new_info = int_check(new_info_uncheck) + teams[team_view][information_category] = new_info + elif information_category == "robot_camera": + print(teams[team_view][information_category]) + new_info_uncheck = input("What would you like to change this value to? ") + new_info = bool_check(new_info_uncheck) + teams[team_view][information_category] = new_info + else: + print(teams[team_view][information_category]) + new_info = input("What would you like to change this value to? ") + teams[team_view][information_category] = new_info + else: + print("This is not an information category.") + else: + print("This is not an existing team number.") + + elif initial_user_request == "remove": + delete_team_uncheck = input("Which team would you like to remove? ") + delete_team = int_check(delete_team_uncheck) + + if delete_team in teams: + teams.pop(delete_team, None) + else: + print("This is not an existing team number.") + + elif initial_user_request == "search": + search_teams = input("Which team would you like to see? (By name or number) ") + if teams == {}: + print("There are no teams in the dictionary.") + else: + for team, category in teams.items(): + found_team = False + if search_teams == category["team_name"]: + print("This is an existing team in the dictionary.") + found_team = True + break + elif search_teams[0].isdigit() and int(search_teams) == team: + print("This is an existing team in the dictionary.") + found_team = True + break + if found_team != True: + print("This is not an existing team.") + + elif initial_user_request == "list": + for team in teams.keys(): + print(team) + print("These are the current teams in the dictionary.") + + else: + print("That is not a search option.") + diff --git a/ch_3_assign_lucca_braudagan.py b/ch_3_assign_lucca_braudagan.py new file mode 100644 index 0000000..b1ccca9 --- /dev/null +++ b/ch_3_assign_lucca_braudagan.py @@ -0,0 +1,150 @@ +def add_team(): + temp_team_dictionary = {} + + team_number = int(input("What is your team's team number? ")) + + temp_team_dictionary["team_name"] = input("What is your team's name? ") + temp_team_dictionary["robot_name"] = input("What is your robot's name? ") + temp_team_dictionary["robot_p_language"] = input("What is your robot's programming language? ") + temp_team_dictionary["robot_width"] = input("What is your robot's width? ") + temp_team_dictionary["robot_height"] = input("What is your robot's height? ") + temp_team_dictionary["robot_camera"] = input("Does your robot have a camera vision system? ") + temp_team_dictionary["robot_drivetrain"] = int(input("How many drivetrain motors does your robot have? ")) + + teams[team_number] = temp_team_dictionary + +def view_or_modify_team(team_view): + if team_view in teams: + information_category = input("What category would you like to view or modify? ") + if information_category in teams[team_view]: + print(teams[team_view][information_category]) + new_info = input("What would you like to change this value to? ") + teams[team_view][information_category] = new_info + else: + print("This is not an information category.") + else: + print("This is not an existing team number.") + +def remove_team(delete_team): + if delete_team in teams: + teams.pop(delete_team, None) + else: + print("This is not an existing team number.") + +def search_team(search_teams): + for team, category in teams.items(): + found_team = False + if search_teams == category["team_name"]: + print("This is an existing team in the dictionary.") + found_team = True + break + elif search_teams[0].isdigit() and int(search_teams) == team: + print("This is an existing team in the dictionary.") + found_team = True + break + if found_team != True: + print("This is not an existing team.") + +def list_team(): + for team in teams.keys(): + print(team) + print("These are the current teams in the dictionary.") + +teams = { + 1678 : { + "team_name" : "Citrus Circuits", + "location" : "Davis, CA", + "rookie_year" : 2005, + "competed_in_2019_season" : True, + "2019_competition_names_and_locations" : { + "Central Valley Regional" : "Fresno, CA", + "Sacramento Regional" : "Davis, CA", + "Aerospace Valley Regional" : "Lancaster, CA", + "Carver Division" : "Houston, TX", + "Einstein Field" : "Houston, TX", + "RCC Qianjiang International Robotics Invitational" : "Hangzhou, Zhejiang, China", + "Chezy Champs" : "San Jose, CA" + }, + "2019_season_awards" : [ + "Regional Chairman's Award At Central Valley Regional", + "Regional Winners At Central Valley Regional", + "FIRST Dean's List Finalist Award", + "Regional Winners At Sacramento Regional", + "Industrial Design Award Sponsored By General Motors", + "Regional Winners At Aerospace Valley Regional", + "Excellence In Engineering Award Sponsered By Delphi", + "Championship Subdivision Winner In Carver Divison", + "Entrepreneurship Award Sponsored By Kleiner Perkins Caufield And Byers"] + }, + 4322 : { + "team_name" : "Clockwork Oranges", + "location" : "Orange, CA", + "rookie_year" : 2012, + "competed_in_2019_season" : True, + "2019_competition_names_and_locations" : { + "San Diego Regional Presented By Qualcomm" : "Del Mar, CA", + "Las Vegas Regional" : "Las Vegas, NV", + "Einstein Field" : "Houston, TX", + "Battleship Blast Monday" : "San Pedro, CA", + "Beach Blitz" : "Huntington Beach, CA" + }, + "2019_season_awards" : [ + "FIRST Dean's List Finalist Award", + "FIRST Dean's List Award"] + }, + 5458 : { + "team_name" : "Digital Minds", + "location" : "Woodland, CA", + "rookie_year" : 2015, + "competed_in_2019_season" : True, + "2019_competition_names_and_locations" : { + "Central Valley Regional" : "Fresno, CA", + "Sacramento Regional" : "Davis, CA" + }, + "2019_season_awards" : "None" + }, + 1 : { + "team_name" : "The Juggernauts", + "location" : "Pontiac, MI", + "rookie_year" : 1997, + "competed_in_2019_season" : True, + "2019_competition_names_and_locations" : { + "FIM District Center Line Event" : "Center Line, MI", + "FIM District Troy Event" : "Troy, MI" + }, + "2019_season_awards":"Imagery Award In Honor Of Jack Kamen" + }, + 7229 : { + "team_name" : "Electronic Eagles", + "location" : "Sacramento, CA", + "rookie_year" : 2018, + "competed_in_2019_season" : True, + "2019_competition_names_and_locations" : { + "Sacramento Regional" : "Davis, CA" + }, + "2019_season_awards" : "None" + } +} + +while True: + initial_user_request = input("Choose from: 'add' 'view_or_modify' 'remove' 'search' 'list' ") + if initial_user_request == "add": + add_team() + + elif initial_user_request == "view_or_modify": + team_view = int(input("Which team would you like to view? ")) + view_or_modify_team(team_view) + + elif initial_user_request == "remove": + delete_team = int(input("Which team would you like to remove? ")) + remove_team(delete_team) + + elif initial_user_request == "search": + search_teams = input("Which team would you like to see? (By name or number) ") + search_team(search_teams) + + elif initial_user_request == "list": + list_team() + + else: + print("That is not a search option.") diff --git a/ch_4_assign_lucca_braudagan.py b/ch_4_assign_lucca_braudagan.py new file mode 100644 index 0000000..5f25aa6 --- /dev/null +++ b/ch_4_assign_lucca_braudagan.py @@ -0,0 +1,74 @@ +from math import sqrt + +class Point: + def __init__(self, x_value, y_value): + self.x_value = x_value + self.y_value = y_value + + def distance(self): + return sqrt(x_value ** 2 + y_value ** 2) + +class Point_3D(Point): + def __init__(self, x_value, y_value, z_value): + super().__init__(x_value, y_value) + self.z_value = z_value + + def distance(self): + distance_2D = super().distance() + return sqrt(distance_2D ** 2 + z_value ** 2) + +def int_validation(prompt): + while True: + if prompt.isdigit(): + return int(prompt) + else: + prompt = input("This is not a valid number. Try again. ") + +x_value_2D = input("What is the x-value of your 2D point? ") +x_value = int_validation(x_value_2D) + +y_value_2D = input("What is the y-value of your 2D point? ") +y_value = int_validation(y_value_2D) + +point_2D = Point(x_value, y_value) +point_2D_distance = point_2D.distance() + +x_value_3D = input("What is the x-value of your 3D point? ") +x_value = int_validation(x_value_3D) + +y_value_3D = input("What is the y-value of your 3D point? ") +y_value = int_validation(y_value_3D) + +z_value_3D = input("What is the z-value of your 3D point? ") +z_value = int_validation(z_value_3D) + +point_3D = Point_3D(x_value, y_value, z_value) + +point_3D_distance = point_3D.distance() + +if point_2D_distance > point_3D_distance: + print(point_2D_distance) + print("is greater than") + print(point_3D_distance) + print("The distance of the 2D point in farther from the origin than the 3D point.") + +elif point_2D_distance < point_3D_distance: + print(point_2D_distance) + print("is less than") + print(point_3D_distance) + print("The distance of the 2D point in closer to the origin than the 3D point.") + +elif point_2D_distance == point_3D_distance: + print(point_2D_distance) + print("is equal to") + print(point_3D_distance) + print("The 2D point and 3D point are equal distance from the origin.") + +else: + print("Something went wrong. The 2D point distance is not greater than, less than, or equal to the 3D point distance from the origin.") + + + + + + diff --git a/numbers.py b/numbers.py new file mode 100644 index 0000000..dec3207 --- /dev/null +++ b/numbers.py @@ -0,0 +1,21 @@ +#def int_validation(prompt): +# while True: +# if prompt.isdigit(): +# return int(prompt) +# else: +# prompt = input("This is not a valid number. Try again. ") + + +def minimum(numbers): + smallest_number = numbers[0] + for index in range(1, 5): + if smallest_number < numbers[index]: + pass + else: + smallest_number = numbers[index] + return smallest_number + + +def next_smallest(numbers): + next_smallest_number = numbers[0] + diff --git a/optional_assignments.py b/optional_assignments.py new file mode 100644 index 0000000..9224292 --- /dev/null +++ b/optional_assignments.py @@ -0,0 +1,64 @@ +""" +#1 assignment +def divisible(x, y): + if x % y == 0: + return True + else: + return False +""" +""" +#2 assignment +def cent_change(cents): + dollars = cents // 100 + a = cents % 100 + quarters = a // 25 + b = a % 25 + dimes = b // 10 + c = b % 10 + nickels = c // 5 + d = c % 5 + pennies = d +""" +""" +#3 assignment +def fibonacci(): + a = 0 + b = 1 + for i in range(1, 20): + c = a + b + a = b + b = c + print(a) +fibonacci() +""" + +#4 assignment +def int_check(user_input): + while True: + if user_input.isdigit(): + return(int(user_input)) + else: + user_input = input("This is not a numeral value for your input. Try again. ") + + +def factorial(number): + a = number + b = number - 1 + for cat in range(1, number): + c = a * b + a = c + b = b - 1 + return(a) + + +def calculating_e(): + a = 1 + for yowl in range(1, 20): + a += 1 / factorial(yowl) + return(a) + + +purr = input("Input a number. ") +meow = int_check(purr) +print(factorial(meow)) +print(calculating_e())