Grade function wont display string | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Grade function wont display string

def my_Grade (x): s=' ' if x>=70: s='A ' elif x>=60: s='B' elif x>=50: s='C' elif x>=45: s='D' elif x>=40: s='F' return my_Grade def my_Point (my_Grade , cl): int (tcp=0) if my_Grade=='A': tcp= cl*5 elif my_Grade=='B': tcp=cl*4 elif my_Grade=='C': tcp=cl*3 elif my_Grade=='D': tcp=cl*2 elif my_Grade=='E': tcp=cl*1 elif my_Grade=='F': tcp=cl*0 return my_Point print('Grade point for CSC STUDENTS 100l\n input your course scores and their respective credit loads:') print('Gst102:') A=int(input()) print('Credit load:') a=int(input()) #Gst104=int(input('Gst104:')) #Gst104_cl=int(input('Gst104 credit load:')) #Phy108=int(input('Phy108:')) #Phy108_cl=int(input('Phy108 credit load:')) print ('grade for gst102:') A=print(my_Grade)

2nd Jun 2020, 10:31 AM
Anosike Jayson
3 Answers
+ 7
Mistakes: 1. You don't initialize variables in python 2. You're returning the function itself, you should return a and tcp and not the function
2nd Jun 2020, 10:35 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 5
Aymane Boukrouh [EXAMS] Your second point is correct!! But the first point is wrong, python doesn't require initialisation of variables...
2nd Jun 2020, 11:37 AM
Namit Jain
Namit Jain - avatar
+ 5
There have been some issues in the code. See the comments. Code should work now. https://code.sololearn.com/cj562lymUMg8/?ref=app
2nd Jun 2020, 1:41 PM
Lothar
Lothar - avatar