“Número positivo e negativo em Python” Respostas de código

Obtenha número aleatório positivo ou negativo python

import random
return 1 if random.random() < 0.5 else -1
Flying Donkey

converter negativo em positivo em python

>>> n = -42
>>> -n       # if you know n is negative
42
>>> abs(n)   # for any n
42
>>> abs(-5.05)
5.05
NA RACE

Número positivo e negativo em Python

num = float(input("Enter a number: "))
if num > 0:
   print("Positive number")
elif num == 0:
   print("Zero")
else:
   print("Negative number")
Mahesh barole

Respostas semelhantes a “Número positivo e negativo em Python”

Perguntas semelhantes a “Número positivo e negativo em Python”

Mais respostas relacionadas para “Número positivo e negativo em Python” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código