When you're evaluating -12**2 you're essentially evaluating -(12**2).

And also, (-12) squared is always 144.

If you want to retain the sign use -(12**2). If you don't want the sign to be retained, use (-12)**2

If you're trying to evaluate the square root of a negative number. It is going to be the same as the sqrt of the positive number multiplied by imaginary i

Just evaluate negative numbers the same way you would positive numbers, and append i to it.

In your particular case, the min function is screwing things up when you evalute negative numbers

Answer from usernamenotfound on Stack Overflow
🌐
Reddit
reddit.com › r/python › if i want to use negative of a variable, is -var enough?
r/Python on Reddit: If I want to use negative of a variable, is -var enough?
February 16, 2019 -

Should I use answer = 0 - var or is answer = -var enough?

For those of you familiar with finance: I have the term S from black-scholes model set to the variable s, and depending on whether i say to value a call or a put, I will use s or -s

🌐
GeeksforGeeks
geeksforgeeks.org › python › working-with-negative-numbers-in-python
Working with Negative Numbers in Python - GeeksforGeeks
July 23, 2025 - ... # Example of basic arithmetic operations a = -5 b = 3 sum_result = a + b difference_result = a - b product_result = a * b quotient_result = a / b print("Sum:", sum_result) print("Difference:", difference_result) print("Product:", product_result) ...
Discussions

Python negative values in variables in multiplication - Stack Overflow
I'm working on a program from Guttag's book, specifically altering the code from page 33 to work with negative numbers. The program is trying to find the square root of a number by using bisection ... More on stackoverflow.com
🌐 stackoverflow.com
working with negative numbers in python - Stack Overflow
I am a student in a concepts of programming class. The lab is run by a TA and today in lab he gave us a real simple little program to build. It was one where it would multiply by addition. Anyway, ... More on stackoverflow.com
🌐 stackoverflow.com
If I want to use negative of a variable, is -var enough?
Depends on the type of the variable. Are we talking integers/floats here? Some vector type? Some weird class that prints "POTATO" when you call __neg__? Nah I'm messing with you. Although the behavior could be different depending on type, based on context I can tell you that they will be the same. However, this would take all of like 5 seconds for you to test on your own. Also, if you must ask, please ask in r/learnpython in the future. More on reddit.com
🌐 r/Python
21
0
February 16, 2019
Is there any language in which negative numbers are false?
Testing for zero is really not slower than testing for a negative value at the machine level at least on x86. In x86 you would do a test reg, reg followed by either jz or js. More on reddit.com
🌐 r/ProgrammingLanguages
34
35
October 27, 2023
🌐
Medium
mipsmonsta.medium.com › how-negative-numbers-are-represented-in-python-243c2a594015
How Negative Numbers are Represented in Python? | by Mipsmonsta | Medium
September 14, 2022 - If you print out the variable result, the output will be 4294967292. So how do we get back -4 from the bitstring of 11111111111111111111111111111100? ... def negativeRepToNumber(self, bitList: List[str]):""" In order to allow bit-wise operations, python represents negative number e.g.
🌐
AskPython
askpython.com › python-modules › numpy › numpy-negative
Numpy negative - Numerical negative, element-wise. - AskPython
February 16, 2023 - This code uses NumPy.negative(variable_name) method to create a negative element and prints the corresponding output. import numpy as np x = 12 y = 99 print(" Original value of x:",x,"\n Negative value of x:",np.negative(x)) print(" Original ...
🌐
AlgoCademy
algocademy.com › link
Return Negative in Python | AlgoCademy
Create a function that takes a number as an argument and returns negative of that number.
Find elsewhere
🌐
Kodeclik
kodeclik.com › how-to-make-something-negative-in-python
How to make a number negative in Python
September 16, 2024 - To make a number negative in Python, use 1. The Negation Operator. 2. Multiply by -1. 3. Use the abs() function with a negation. Or 4. Use a lambda function.
🌐
Programiz
programiz.com › python-programming › examples › positive-negative-zero
Python Program to Check if a Number is Positive, Negative or 0
To understand this example, you should have the knowledge of the following Python programming topics: ... num = float(input("Enter a number: ")) if num > 0: print("Positive number") elif num == 0: print("Zero") else: print("Negative number")
🌐
Pierian Training
pieriantraining.com › home › how to check if a number is negative in python: a beginner’s guide
How to Check if a Number is Negative in Python: A Beginner's Guide - Pierian Training
June 18, 2023 - Here’s an example code snippet that demonstrates this method: num = -5 if num < 0: print("The number is negative.") else: print("The number is non-negative.") In this code, we assign the value -5 to the variable ...
🌐
Boot.dev
boot.dev › lessons › e0fe3f7c-c0ee-4d02-be2c-b770ddfa477e
Learn Python for Beginners: Negative Numbers | Boot.dev
Negative numbers in Python work the way you probably expect. Just add a minus sign: ... When our hero walks through poison, their health should go down. Right now the hero is gaining 10 health instead of losing 10 health.
🌐
CodeRivers
coderivers.org › blog › how-to-make-something-negative-in-python
Making Something Negative in Python: A Comprehensive Guide - CodeRivers
February 22, 2026 - To make an integer negative, you simply prefix it with a minus sign (-). For example: positive_integer = 5 negative_integer = -positive_integer print(negative_integer) In this code, we first define a positive integer positive_integer with a value of 5. Then, we create a new variable ...
🌐
Code.mu
code.mu › en › python › book › prime › basis › negative-numbers
Negative Numbers in Python
Let's say you have a variable test with a negative number. Subtract -20 from it.
🌐
Medium
zlliu.medium.com › how-and-work-with-negative-numbers-in-python-eg-37-10-790344777384
How // And % Work With Negative Numbers In Python eg. ( 37 % -10 ) | by Liu Zuo Lin | Medium
August 29, 2024 - How // And % Work With Negative Numbers In Python eg. ( 37 % -10 ) Disclaimer — this will probably not be useful in real life. I read up on this because I’ll be tested on this during an exam (and …
🌐
Vultr
docs.vultr.com › python › examples › check-if-a-number-is-positive-negative-or-0
Python Program to Check if a Number is Positive, Negative or 0 | Vultr Docs
December 9, 2024 - def check_number_sign(num): if num > 0: return "Positive" elif num < 0: return "Negative" else: return "Zero" # Example calls print(check_number_sign(10)) # Positive print(check_number_sign(-5)) # Negative print(check_number_sign(0)) # Zero Explain Code
🌐
ItSolutionstuff
itsolutionstuff.com › post › how-to-get-only-negative-values-in-python-listexample.html
How to Get Only Negative Values in Python List? - ItSolutionstuff.com
October 30, 2023 - Then i will use filter and sorted() function to get only negative value from python list. so let's see the following example. You can use these examples with python3 (Python 3) version.
🌐
GeeksforGeeks
geeksforgeeks.org › numpy-negative-in-python
numpy.negative() in Python | GeeksforGeeks
November 28, 2018 - Input number : 10 negative of input number : -10 Code #2 : ... # Python program explaining # numpy.negative function import numpy as geek in_arr = geek.array([[2, -7, 5], [-6, 2, 0]]) print ("Input array : ", in_arr) out_arr = geek.negative(in_arr) ...
🌐
Quora
quora.com › How-can-we-represent-negative-integers-in-Python
How can we represent negative integers in Python? - Quora
Answer (1 of 2): Integers are a built-in type in Python. The Python interpreter handles the common decimal representation for input and output, e.g. “-69”, but can be induced to input in other bases as well via the second argument to int. For output, bin, oct, and hex can be used for bases ...
🌐
WsCube Tech
wscubetech.com › resources › python › programs › positive-negative-zero
Python Program to Check if a Number is Positive, Negative or 0
May 28, 2026 - Learn how to write a Python program to check if a number is positive, negative, or zero. Simple steps to determine the nature of any number using Python.
🌐
CodeRivers
coderivers.org › blog › python-negative-infinity
Python Negative Infinity: A Comprehensive Guide - CodeRivers
February 22, 2026 - # Initialize a variable to negative infinity to find the minimum value in a list min_candidate = float('-inf') for element in data_list: # Compare each element with the current minimum candidate if element < min_candidate: min_candidate = element · Python's negative infinity (float('-inf')) is a powerful and useful concept.