# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     name: python3
# ---

# + [markdown] id="view-in-github" colab_type="text"
# <a href="https://colab.research.google.com/github/PhilippeJustine/CPEN-21A-ECE-2-1/blob/main/Final_Exam.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>

# + [markdown] id="fIHmPgKnTAq6"
# #Final Exam

# + [markdown] id="NfGSfToahj4d"
# Binato, <NAME>.
# | BSECE 2-1

# + [markdown] id="-KSrRd2OTP7W"
# Problem Statement 1

# + colab={"base_uri": "https://localhost:8080/"} id="tmLLxdT1Ta39" outputId="62be624a-e5d9-46fe-c5cf-f602ae6ce15b"
print("INPUT NUMBERS LESS THAN 5")
print("")

num=[]
x=0
for x in range (0,10):
  while True:
    a=float(input("Input a Numerical Value:"))
    if a<5:
      print("")
      break;
    else:
      print("   Invalid Input! Input a numerical value <5.")
    continue;
  num.append(a)
  x+=1

x=0
sum=0
print("The inputs you've entered are", num)
print("")
for x in num:
  if x<5:
    sum=sum+x
print("The sum of the inputs less than 5 is", sum )

# + [markdown] id="aJKIXU9YX1bC"
# Problem Statement 2

# + colab={"base_uri": "https://localhost:8080/"} id="6UC8GWd6a0C9" outputId="e5d766ec-03ee-45bc-8f8c-6ee91e0771e7"
print("INPUT FIVE NUMBERS")
print("")

a=1
num={}
sum=0
while a<=5:
  num[a]=float(input("Input a Numerical Value:"))
  print("")
  a+=1
  if a==6:
    sum=float(num[1])+float(num[5])

print("The sum of first and last inputs is", sum)

# + [markdown] id="CtUn-08raCTl"
# Problem Statement 3

# + colab={"base_uri": "https://localhost:8080/"} id="5ZZpILXlxPhi" outputId="da3897a7-32eb-4ac4-ae50-d63f27895b2e"
print("INPUT YOUR GRADE")
print("")

while True:
  try: 
    grade = int(input("Input your grade: "))
    if grade<=float('inf'):
      break;
    else:
      print("   Input should be an integer")
  except:
    print("   Input should be an integer")
    continue;

print("")
if grade >= 90: print("You got an A!")
else:
  if grade >= 80: print("You got a B!")
  elif grade >= 70: print("You got a C!")
  elif grade >= 60: print("You got a D!")
  else: print("You got and F!")

StarcoderdataJupyterScriptsDedupFiltered