How do you solve the None problem whihc I get in the end? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do you solve the None problem whihc I get in the end?

https://code.sololearn.com/cImvOri9dpux/?ref=app

27th Sep 2017, 8:26 PM
Serge Vyent
Serge Vyent - avatar
10 Answers
+ 9
cipher is right the return statement is missing this why the None is there you're function doesn't return anything and also use variables to store inputs and use them
20th Oct 2017, 11:55 AM
Hasan Fares
Hasan Fares - avatar
+ 4
You defined a function. You have the function do a certain job. Now... look at your print statement. It's not inside of the function. So, to my knowledge, you have two options: 1. Place the print statement inside the function or 2. Make sure to "return" the value that you wish to print at the end of the function and assign the output to a variable. like... def afunction(): x = input("input:") return x y = afunction() print(y) The value that you wish to print is inputted while inside the function, and by default is private, and not accessible by anything outside of that function, unless it is passed into the function as a parameter and/or returned from that function.
20th Oct 2017, 11:47 AM
Fox
Fox - avatar
+ 3
I'm confused on why you have "if input..." What condition are you wanting to check?
27th Sep 2017, 9:01 PM
Mark McGhee
Mark McGhee - avatar
+ 3
thank you guys. I'll give it a try
15th Nov 2017, 11:41 PM
Serge Vyent
Serge Vyent - avatar
+ 2
but why "if"? why not just input?
28th Sep 2017, 1:10 AM
Mark McGhee
Mark McGhee - avatar
+ 2
try taking the prompt for number of students out of the for loop. prompt for number of students, store in a variable and then do your for loop to get names and marks
28th Sep 2017, 1:31 AM
Mark McGhee
Mark McGhee - avatar
+ 1
alright I'll try that. I'll let you know how it worked
28th Sep 2017, 1:51 AM
Serge Vyent
Serge Vyent - avatar
0
i have the "if input" so that I can enter a name and the Persons mark.
28th Sep 2017, 1:07 AM
Serge Vyent
Serge Vyent - avatar
0
I have tried that too ans still get the None in the end. which means I cant go further. because after i have the names and marks. i need to sort them from highest numner to lowest. but I get <nonetype> in the end as error.
28th Sep 2017, 1:27 AM
Serge Vyent
Serge Vyent - avatar
0
it still ends up with none. i believe because levelup is not defined to be anything so you get none. how do I give that a value
29th Sep 2017, 4:53 PM
Serge Vyent
Serge Vyent - avatar