Python Forum
Return Statement in Python IDLE editor
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Return Statement in Python IDLE editor
#1
Hi, I'm somewhat of a programming "newbie" , so bear with me.

I have been practising with Python (2) through Python IDLE. However, when I type code in the editor window and utilize a return statement, the return statement doesn't work after I run the code (there's no output in the shell window). Normally I would be able to type my code in the editor window, run it,and then get the results in the shell window.

However, when I type that same code in the shell window, and run the code, the return statement does work. How do I solve this? I want to be able to just type my code in editor mode, and then run.


def compare(x,y):
       if x > y:
               return 1
       if x == y:
               return 0
       if x < y:
               return -1

compare(5,7)
Reply


Messages In This Thread
Return Statement in Python IDLE editor - by NMW - Jul-11-2017, 06:44 PM
RE: Return Statement in Python IDLE editor - by NMW - Jul-11-2017, 07:40 PM
RE: Return Statement in Python IDLE editor - by NMW - Jul-11-2017, 08:48 PM
RE: Return Statement in Python IDLE editor - by NMW - Jul-11-2017, 09:31 PM
RE: Return Statement in Python IDLE editor - by NMW - Jul-11-2017, 09:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python editor that will SFTP automatically on save sawtooth500 1 344 Apr-30-2024, 05:13 AM
Last Post: Gribouillis
  Why can I not see the code correctly in Python IDLE.? Trump 8 877 Apr-04-2024, 07:47 AM
Last Post: jonesphedra
  Launch Python IDLE Shell from terminal Pavel_47 5 1,386 Feb-17-2023, 02:53 PM
Last Post: Pavel_47
  Python Idle won't start totalmachine 9 3,700 Oct-16-2022, 05:57 PM
Last Post: totalmachine
  Why is IDLE not opening on a MacOS Montery 12.6 and using Python 3.10.7? Merlin385 7 1,846 Oct-08-2022, 08:36 PM
Last Post: Merlin385
  Need help with Return statement Columbo 13 2,490 Sep-17-2022, 04:03 PM
Last Post: Columbo
  Sublime Text Editor not recognizing Python elroberto 5 3,078 Jun-13-2022, 04:00 PM
Last Post: rob101
  Music Notation editor; how to build the editor? direction to go? philipbergwerf 1 1,795 Jan-01-2022, 04:56 PM
Last Post: Larz60+
  MAC Python IDLE issue shadow12 4 2,667 Oct-29-2021, 12:22 AM
Last Post: shadow12
  Python MYSQL connection does not work after 1h idle zazas321 9 7,148 Oct-07-2021, 12:02 PM
Last Post: ndc85430

Forum Jump:

User Panel Messages

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