+ 6

[SOLVED] Can't print out function

Why i cannot print out my print("Average:",cal_ave(stud_mark))? Both function works fine if i print it out in separate doc but when i put both of them in one doc, it cannot print out. stud_name = input("Enter student names *separates by commas*:") stud_mark = map(int,input("Enter marks *separates by commas*:").split(',')) def cal_total(stud_mark): total = 0 for x in stud_mark: total +=x return total print("Total",cal_total(stud_mark)) def cal_ave(stud_mark): ave= 0 ave = sum(stud_mark)/len(stud_name) return ave print("Average:",cal_ave(stud_mark))

15th Jun 2018, 6:52 AM
Samantha philip
Samantha philip - avatar
2 odpowiedzi
+ 8
I linked your thread here, and got a good explanation on why your second function call produces faulty results: https://www.sololearn.com/Discuss/1347924/?ref=app
15th Jun 2018, 11:49 AM
Hatsy Rei
Hatsy Rei - avatar
+ 2
Thank you very much
15th Jun 2018, 12:49 PM
Samantha philip
Samantha philip - avatar