Based on the name of the function, it seems that we're supposed to only print the value of quantity to the console.
def show_value(quantity):
print(quantity)
show_value(12)
The first line of code creates the function, the second line of code prints the value of quantity to the console, and the last line of code calls our show_value function with 12 as our argument. I wrote my code in python 3.8. I hope this helps.
Yes because you won't have too much light and you won't have too little
lst=([])
def avgGPA(lst1):
total = 0
count = 0
for x in lst:
if type(x) == int:
total += x
count += 1
return total/count
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:
lst.append(dictionary[grade]+1)
return "Your GPA score is: " + str(dictionary[grade] + 1)
elif weighted == 0 and grade in dictionary:
lst.append(dictionary[grade])
return "Your GPA score is: " + str(dictionary[grade])
else:
lst.append("Invalid")
return "Invalid"
classes = int(input("How many Classes are you taking? "))
i = 0
while i < classes:
print(GPAcalc(input("Enter your Letter Grade: "), int(input("Is it weighted? (1 = yes) "))))
i += 1
print("Your weighted GPA is a "+str(avgGPA(lst)))
If you need me to change any code, I'll do my best. I hope this helps!
The built-in function you use in python to prompt a user for data input is the input function.
<h3>What is an input function?</h3>
An input function is a function used to prompt a user for data input.
The data input may be a string, integer, float, and many more.
Let's use an example of an input function in python.
x = input("what is your name: ")
y = int(input("How old are you: "))
Hence, the first input will prompt the user for the name and the second input will ask the user for his age. It can only accept integers.
learn more on input function here: brainly.com/question/17623507
#SPJ12