+ 1
How do you solve the None problem whihc I get in the end?
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
+ 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.
+ 3
I'm confused on why you have "if input..." What condition are you wanting to check?
+ 3
thank you guys. I'll give it a try
+ 2
but why "if"? why not just input?
+ 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
+ 1
alright I'll try that. I'll let you know how it worked
0
i have the "if input" so that I can enter a name and the Persons mark.
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.
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