Computer Science, asked by throwaway22222, 7 months ago

7.4 Edhesive code practice question 2:

I can't find anything about it online and the examples/videos provided didn't offer much help. I'm stressing really bad over it because the previous assignment I did (that is the "previous code") I got wrong because I didn't include a return parameter (mostly because anything I tried wouldn't work).

Attachments:

Answers

Answered by govardhanreddybasire
0

Answer:

question is not proper check out once

Answered by poojan
37

Language used: Python Programming

Program:

li={'A':4,'B':3,'C':2,'D':1,'F':0}

def weighted(a,b):

   if a not in li.keys():

       return "Invalid"

   else:

       if b==1:

           return li[a]+1

       else:

           return li[a]

print("Your GPA score is: ",weighted(input("Enter your Letter Grade: "),int(input("Is it weighted? (1 = yes, 0 = no) "))))

Inputs and outputs:

Input 1:

Enter your Letter Grade: B

Is it weighted? (1 = yes, 0 = no) 1

Output 1:

Your GPA score is:  4

Input 2:

Enter your Letter Grade: B

Is it weighted? (1 = yes, 0 = no) 0

Output 2:

Your GPA score is:  3

Learn more:

1) Printing all the palindromes formed by a palindrome word.

brainly.in/question/19151384

2) Write a Python function sumsquare(l) that takes a nonempty list of integers and returns a list [odd,even], where odd is the sum of squares all the odd numbers in l and even is the sum of squares of all the even numbers in l.

brainly.in/question/15473120

Similar questions