+ 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))
2 Answers
+ 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
+ 2
Thank you very much