# ---
# 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/kathleenmei/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="MpyHvucW9uFF"
# ## PROBLEM STATEMENT 1.

# + colab={"base_uri": "https://localhost:8080/"} id="yRfaHwXY9tN4" outputId="989a9c60-ea3c-4120-c515-db72e5c4e6da"
num=[]
x=0
for x in range(1,11):
  while True:
    y=float(input("Enter a number:"))
    if y<5:
      break
    else:
      print("Invalid, please put a number less than 5")
      continue
  num.append(y)
  x+=1

x=0
summation=0
print("The numbers you entered are:",num)
print("")
for x in num:
  if x<5:
    summation=summation+x
print("The sum of numbers that are less than 5 is:",summation)

# + [markdown] id="oeeADn9r90Xg"
# ## PROBLEM STATEMENT 2.

# + colab={"base_uri": "https://localhost:8080/"} id="UzqzXCAx-Wo9" outputId="3f9dd0e0-df4c-428f-adde-ac85f5341b64"
num = 1;
data = {};
while (num<=5):
  c = str(num);
  data[num] = input("Enter a number:")
  print("The value for number " +c+ " is " +data[num])
  num+=1
  if(num==6):
    sum= int(data[1])+int(data[5])
print("The sum of the first and last number is:"+str(sum))

# + [markdown] id="xT7X1gn892qW"
# ## PROBLEM STATEMENT 3.

# + colab={"base_uri": "https://localhost:8080/"} id="xUQgHnjT_D1M" outputId="0cdacfeb-98b0-465b-e812-8dd5508acef7"
grade = int(input("Enter your grade:"))
if grade>=90:
  print("A")
elif grade>=80:
  print("B")
elif grade>=70:
  print("C")
elif grade>=60:
  print("D")
else:
  print("F")

StarcoderdataJupyterScriptsDedupFiltered