1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Masja [62]
3 years ago
13

7.4 Code Practice: Question 2

Computers and Technology
1 answer:
Nuetrik [128]3 years ago
8 0

def GPAcalc(grade, weighted):

   grade = grade.lower()

   dictionary = {"a": 4, "b": 3, "c": 2, "d": 1, "f": 0}

   if weighted == 1 and grade in dictionary:

       return "Your GPA score is: "+str(dictionary[grade] + 1)

   elif weighted == 0 and grade in dictionary:

       return "Your GPA score is : "+str(dictionary[grade])

   else:

       return "Invalid"

print(GPAcalc(input("Input a letter grade: "), int(input("Is it weigthed? (1= yes, 0= no)"))))

I modified the code a bit to cut down on the use of if and elif statements. If you need me to change it, I will. Best of luck.

You might be interested in
How can you ensure you don't go over your budget?
Alenkinab [10]
Round up your experience estimates to add a buffer.
3 0
3 years ago
A ________ database state is one in which all data integrity constraints are satisfied
beks73 [17]
A consistent database base is one in which all data integrity constraints are satisfied.
8 0
3 years ago
Read 2 more answers
Properties of variable in QBASIC​
Arlecino [84]

Explanation:

assume numeric value and is represented by an alphabet or an alphabet followed by another alphabet or digit. ...

String variable : A string variable is represented by an alphabet followed by dollar ()sign.

4 0
3 years ago
What's the necessary tool to work in pyrotechnics.​
I am Lyosha [343]

Answer:

I think these are some if they arent ill do some research

Explanation:

aluminum foil, duct or masking tape, end cutters, a claw hammer,flashlight,hard hat, shovel and plastic bucket.

5 0
3 years ago
Read 2 more answers
Using the Internet as interpersonal communication. Find a way to
Tomtit [17]

Answer:

Idk if an app is ok too but for an app there is one called monkey. my friend showed it me. you can meet a loy of new people on there. its a speed video call with everyone. I think you get 30 seconds and if you want to talk more then you just add time or add each other as friends

4 0
4 years ago
Other questions:
  • Write a function namedadd_complex that adds the correspondingnumbers of its arguments (both complexstructures), then returns the
    5·1 answer
  • g Fill the validateForm function to check that the phone number is 10 characters long and that the user name is less than 11 cha
    9·1 answer
  • With a DUI charge on a driver’s record ______________.
    10·1 answer
  • A support agent who feels that a user needs substantial assistance with the organization of files on their pc should ____.
    5·1 answer
  • For which of the following values of A and B will the expression A || B be true?
    15·1 answer
  • What software could i use to create music like Aphex Twin?
    6·1 answer
  • Can rank u r guys in rocket leagye
    13·1 answer
  • The process of sending a result back to another part of the program is
    14·1 answer
  • Andy works for a TV broadcasting company. He needs to set up a network covering a small area on the work floor. However, he noti
    13·1 answer
  • on early ethernet networks, all computers were connected to a single wire, forcing them to take turns on a local area network (l
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!