#๐ help with a funtion
76 messages ยท Page 1 of 1 (latest)
@hollow peak
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
@ancient crater
print returns None
!paste
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
so c = print(...) is None
His function is returning something
what do you mean with "pulling a function"
like asking the questions
from the funtion
according to the input parameters
which are given
the function print returns none
if you assign a print call to a variable then this variable is None
but within the print, he's calling the elementary_school_quiz(). In which that function shows input()
And that input contains questions
Can you share the code in a pastebin please?
whats that?
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
Share the link
share the link
tq
I still don't get what "pull" means after reading the chat history
def elementary_school_quiz(flag, n):
this function returns None in almost all cases
This doesn't look like an elementary question lol
lmao its just my homework lol
i am just following the instructions
it should return the score
no?
and the questions?
w = print (correct_answer)
print (correct_answer)
return(w)
this returns None
because w is None
n = input("How many practice questions would you like to do? Enter 1 or 2: ")
if ( n == 0 ):
print("Vida, here is your 2 questions: ")
elif (n == 1):
print("vida, here is your 2 questions:")
how do i run the funtion
n input returns a string. Not int
print performs a side effect (writing on stdout) but returns None
oh should i make it an int
but how do i acc make the questions pull up?
its up to you. Either make n an int or compare it with a str
sure ill make it an int
Likewise for the flag
and also you do not need () for return
do yall think that will fix it?
w = print (correct_answer)
print (correct_answer)
return(w)
you need to fix that also
oh sure
To answer that is to actually try it and find out
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.
๐ help with a funtion