logotransparent.png

Legion of Learners

www.lol-101.com

  • Home

  • Classrooms

  • Courses

  • About Us

    • Executive Team
    • Board Members
  • Resources

  • More

    Use tab to navigate through the menu items.
    To see this working, head to your live site.
    • Categories
    • All Posts
    • My Posts
    Eric Wu
    Jun 16
      ·  Edited: Jun 18

    6/15 - Homework Week 2 Day 1

    in Introduction to Python

    HOMEWORK:

    Part 1:

    Use if-elif-else statements to create a grading system where a user inputs a percent grade (0 to 100).

    if 100-90 = A

    else if 89-80 = B

    and so on


    Part 2:

    Use a while loop to print a pattern starting from 1 and ending at 46 where the difference between terms increases by 1:

    1, 2, 4, 7, 11, 16, 22, 29, 37, 47

    Hint: You will need 2 different variables. One of them will be the number you print and the other will be the amount you add.


    RESOURCES:

    Class slides: https://docs.google.com/presentation/d/1UlxFWDgPrOBy-5pybRom5_nRyehCyvPIN2n3mc3Sgkw/edit?usp=sharing

    Example code: https://replit.com/@ShravyaS/IntroToPython-Wk2Day1

    Coding platform: replit.com

    LOL Discord: https://discord.gg/dWVUBmPx


    Post your answers as a comment! I will post the solution before next class.


    You can always email us at shravyassathish@gmail.com (mentor) or kingericwu@gmail.com (TA) or message us on Discord if you have any questions about the homework or what we covered in class.

    5 comments
    0
    melodychangchang
    Jun 16

    #Part 1:


    grade = float(input("Input a percent grade from 0 to 100 and this program will output the equivalent letter grade.: "))


    if 90<=grade>=100:

    print("A")

    elif 80<=grade>=89:

    print("B")

    elif 70<=grade>=79:

    print("C")

    elif 60<=grade>=69:

    print("D")

    else:

    print("F")


    #Part 2:


    num = 1

    addNum = 1


    while addNum <= 10:

    print(num)

    num+=addNum

    addNum+=1

    0
    echeung0808
    Jun 17

    grade = input ("what is the grade percentage? ")

    grade = int(grade)

    if 90 <= grade <= 100 :

    print("A")

    elif 80 <= grade <= 89 :

    print("B")

    elif 70 <= grade <= 79 :

    print("C")

    elif 60 <= grade <= 69 :

    print("D")

    else:

    print("F")


    x=1

    i =1

    while i <= 10:

    print(x)

    x = x+i

    i = i+1

    0
    Eric Wu
    Jun 18

    Solution:


    Part 1:

    p=int(input())

    if p>=90:

    print("A")

    elif p>=80:

    print("B")

    elif p>=70:

    print("C")

    elif p>=60:

    print("D")

    else:

    print("F")


    Part 2:

    num=1

    add=1

    while num < 47:

    print(num)

    num=num+add

    add+=1

    0
    davidkouhouchin
    Jun 19

    grade = float(input("grade percentage"))

    if 97<=grade<=100:

    print("A+")

    elif 94<=grade<=96:

    print("A")

    elif 90<=grade<=93:

    print("A-")

    elif 87<=grade<=89:

    print("B+")

    elif 84<=grade<=86:

    print("B")

    elif 80<=grade<=83:

    print("B-")

    elif 77<=grade<=79:

    print("C+")

    elif 74<=grade<=76:

    print("C")

    elif 70<=grade<=73:

    print("C-")

    elif 67<=grade<=69:

    print("D+")

    elif 64<=grade<=66:

    print("D")

    elif 60<=grade<=63:

    print("D-")

    else: print("F")

    0
    chiao_chuanhung
    4d

    if score>=90:

    grade="A"

    elif score >=80:

    grade = "B"

    elif score >=70:

    grade = "C"

    elif score >=60:

    grade = "D"

    else:

    grade = "F"

    print(f'Your grade is {grade}') ------------------------------- i=1

    j=1

    while i<=47:

    print(i, end=' ')

    i+=j

    j+=1

    0
    5 comments

    Questions? Email us at legionoflearners@gmail.com or join our WeChat group!

    • lol-101dotcom

    ©2020 Legion of Learners