Python return -1 Minus One | Example code

  • by

Just write -1 in Python function return statement to get Minus One.

def return_negative_one():
    return -1



Python return -1 Minus One

If you want to convert boolean into int then use the below code to get Python to return 1

def one():
    myBoolean = True
    return int(myBoolean)


Output: 1

Do comment if you have any doubts and suggestions on this Python return topic.

Note: IDE: PyCharm 2021.3 (Community Edition)

Windows 10

Python 3.10.1

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.