How to remove "None" from output of function related question

Question:

    def function1():
    print("Aww im sorry to hear")
    
def function2():
    print("Thats fantastic")    
    
    
def function3():
    print("Invalid response")    
    

ansr = input(print("Did you have a good day at school? Answer 'Y' or 'N'!!"))

if ansr == "Y":
    function2()
elif ansr == "N":
    function1()
else:
    function3()

Output

    Did you have a good day at school? Answer 'Y' or 'N'!!
None

Is there any reason "none" is being returned?? and if so how would i adjust my code to get rid of it?

Asked By: Shaneb7102

||

Answers:

Don’t print inside input. The prompt message is automatic.

ansr = input("Did you have a good day at school? Answer 'Y' or 'N'!!")

print returns None here a similar example

print(print('Hallo'))

Output

Hallo
None
Answered By: cards
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.