Python Forum
python prints none in function output - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: python prints none in function output (/thread-34217.html)



python prints none in function output - chairmanme0wme0w - Jul-07-2021

i'll attach screenshots but basically i'm making a text-based adventure game for my bridging work for sixth form and idk just look i've tried like returning the first variable but i just dont know how to get rid of the None im begging for help its annoying me so much [attachment=1168][attachment=1167]
p.s pls dont bully my story writing abilities im doing my best !!


RE: python prints none in function output - BashBedlam - Jul-07-2021

The second line in your beginning () function is what's causing the problem. Specifically it's the print statement inside of the input statement.

This is returning None:

this = input (print ('that'))
print ('this')
This is returning the user input:

this = input ('that')
print ('this')



RE: python prints none in function output - chairmanme0wme0w - Jul-07-2021

(Jul-07-2021, 04:36 PM)BashBedlam Wrote: The second line in your beginning () function is what's causing the problem. Specifically it's the print statement inside of the input statement.

This is returning None:

this = input (print ('that'))
print ('this')
This is returning the user input:

this = input ('that')
print ('this')

thank you so much!! this helped alot Big Grin


RE: python prints none in function output - deanhystad - Jul-07-2021

I'll just bully you over your choice of text highlight colors. Unreadable! In the future please post code to the forum, not screen shots.