Activity 4
Activity 4
Activity 4
FUNCTIONS
SUBMITTED BY:
Abrigo, Renz Christian, B.
COE - 1203
SUBMITTED TO:
Sir Mark Rondol P. Abdon
Direction: Write 10 examples of one line code that has built in functions. (1 point each)
Example: char_count = len("hello")
1. hypotenuse = ((((3)**2)+((4)**2))**0.5)
3. absolute_value = abs(-10)
4. all_caps = ("title").upper()
7. rounded_value = round(3.14159265359, 2)
9. triple = ("well…") * 3
Please provide a screenshot of your program. Remember, it's essential to maintain originality when completing this
task.
Republic of the Philippines
BATANGAS STATE UNIVERSITY
The National Engineering University
Alangilan Campus
Golden Country Homes, Alangilan Batangas City, Batangas, Philippines 4200
Tel Nos.: (+63 43) 425-0139 local 2121 / 2221
E-mail Address: [email protected] | Website Address: http://www.batstate-u.edu.ph
Paste your code here use comments to properly document your program.
grades = [] #List of values of grades
def main(): #A loop that lets you choose if you want to add a grade, calculate the grades you listed, or exit the
program
while True:
print("Calculate your General Weighted Average!")
print("1. Add a Grade")
print("2. Calculate Average Grade")
print("3. Exit")
choice = int(input("Enter option: "))
if choice == 1: #Choose to add grade
print("\n")
add_grade()
elif choice == 2: #Choose to calculated the average of your grade
print("\n")
calc_total()
elif choice == 3: #Choose to exit the program
print("\n")
print("Now exiting program...")
break
else: #The user shall only pick from options 1-3
print("Please pick from options 1-3 only.")
main()