Python Forum
python prints none in function output
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python prints none in function output
#1
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        
p.s pls dont bully my story writing abilities im doing my best !!
Yoriz write Jul-07-2021, 06:59 PM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply
#2
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')
chairmanme0wme0w likes this post
Reply
#3
(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
Reply
#4
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  problem in output of a function akbarza 9 1,095 Sep-29-2023, 11:13 AM
Last Post: snippsat
  zfill prints extra et the end of a var tester_V 4 850 Mar-24-2023, 06:59 PM
Last Post: tester_V
  How to print the output of a defined function bshoushtarian 4 1,236 Sep-08-2022, 01:44 PM
Last Post: deanhystad
  Doctesting a function which prints a students name along with the maximum mark scored sean1 5 2,218 Feb-01-2022, 12:20 PM
Last Post: Pedroski55
  output correction using print() function afefDXCTN 3 10,961 Sep-18-2021, 06:57 PM
Last Post: Sky_Mx
  variable prints without being declared. ClockPillow 2 1,771 Jul-11-2021, 12:13 AM
Last Post: ClockPillow
  print function output wrong with strings. mposwal 5 3,045 Feb-12-2021, 09:04 AM
Last Post: DPaul
  Output prints Account.id at the end? LastStopDEVS 5 2,718 Dec-19-2020, 05:59 AM
Last Post: buran
  Output with none, print(x) in function Vidar567 3 2,451 Nov-24-2020, 05:40 PM
Last Post: deanhystad
  Try/Exept prints only ones tester_V 11 3,738 Nov-03-2020, 02:38 AM
Last Post: tester_V

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020