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).
Answers
Answer:
question is not proper check out once
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