#๐Ÿ”’ help with a funtion

76 messages ยท Page 1 of 1 (latest)

pine swanBOT
#

@hollow peak

Python help channel opened

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.

hollow peak
#

@ancient crater

ancient crater
#

hmm

#

Can you share the entire code in a pastebin please?

gaunt pine
#

print returns None

ancient crater
#

!paste

pine swanBOT
#
Pasting large amounts of code

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.

gaunt pine
#

so c = print(...) is None

hollow peak
#

yea

#

it is not pulling the whole funtion

ancient crater
#

His function is returning something

hollow peak
#

with the questions

#

mb i couldnt take full pictures

#

some lines are really long

gaunt pine
hollow peak
#

like asking the questions

#

from the funtion

#

according to the input parameters

#

which are given

gaunt pine
#

the function print returns none

hollow peak
#

yea

#

acc

#

it might be 0

gaunt pine
#

if you assign a print call to a variable then this variable is None

hollow peak
#

lemme check

#

but its not asking the questions

#

idk why

ancient crater
#

but within the print, he's calling the elementary_school_quiz(). In which that function shows input()

#

And that input contains questions

ancient crater
hollow peak
#

whats that?

pine swanBOT
#
Pasting large amounts of code

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.

ancient crater
hollow peak
#

i put it there

#

can you see it?

ancient crater
#

Share the link

gaunt pine
#

share the link

hollow peak
ancient crater
#

tq

hollow peak
#

i am still trying to pull the elementary part.

#

not at the highschool part yet

swift coral
#

I still don't get what "pull" means after reading the chat history

gaunt pine
#

def elementary_school_quiz(flag, n):

this function returns None in almost all cases

ancient crater
hollow peak
#

i am just following the instructions

hollow peak
#

no?

#

and the questions?

gaunt pine
#
w = print (correct_answer)
print (correct_answer)
return(w)
#

this returns None

#

because w is None

ancient crater
#
    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:")
hollow peak
#

how do i run the funtion

ancient crater
#

n input returns a string. Not int

gaunt pine
#

print performs a side effect (writing on stdout) but returns None

hollow peak
#

but how do i acc make the questions pull up?

ancient crater
hollow peak
#

sure ill make it an int

ancient crater
#

Likewise for the flag

gaunt pine
#

and also you do not need () for return

hollow peak
#

do yall think that will fix it?

gaunt pine
#
w = print (correct_answer)
print (correct_answer)
return(w)

you need to fix that also

hollow peak
#

oh sure

ancient crater
hollow peak
#

yea i am fixing that rn

#

coding is sm fun thouhg

ancient crater
hollow peak
#

ill figure out the res guys

#

tyy all sm

#

i was acc stressing

pine swanBOT
#
Python help channel closed

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