# ---
# 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/wellaboriol/CPEN21A-CpE-1-2/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="RCq9SRjXw-5g"
# #Final Exam
#

# + colab={"base_uri": "https://localhost:8080/"} id="SuoSxzhlxC6G" outputId="1f68bbf6-a628-40dd-8fee-295fd4d52f9e"
#PROBLEM STATEMENT 1.
num = [-5,-4,-3,-2,-1,0,1,2,3,4]
sum = 0
for x in num:
  sum = sum + x

print(sum)

# + colab={"base_uri": "https://localhost:8080/"} id="YwifQRtrxmVS" outputId="a36abed1-83c0-4c8a-d47b-ade4758d36cd"
#PROBLEM STATEMENT 2.
num = int(input("Enter any number: "))

last_digit = num % 10

while num > 10:
   num = num // 10

last_digit +=num
print("Sum of the first and last number:", last_digit)

# + colab={"base_uri": "https://localhost:8080/"} id="e5waoJL50qJP" outputId="da7665f0-8859-4b36-ed78-e2e065eaf3b2"
#PROBLEM STATEMENT 3.
grade = float(input("Enter the grade: "))

if grade >= 90:
  char = "A"
else:
    if 80 <= grade <=90:
      char = "B"
    else: 
      if 70 <= grade <80:
        char = "C"
      else:
        if 60 <= grade <70:
          char = "D"
        else:
          char = "F"

print("Character grade: "+ char)

StarcoderdataJupyterScriptsDedupFiltered