-2

How do I make a number so its a decimal? Ex: 0.045 I'm trying to make a game that needs it. Me and my friend are trying to do a random number generator. So like if its a 0.5,Its average. Nothing happens. If its 0.1, you die. That's just an example This is what I have so far

import colorama
import string, random, time
from colorama import Fore, init

number = random.randint(0, 9)

print(Fore.RED(random.sample(numbers,5)))
martineau
  • 112,593
  • 23
  • 157
  • 280
st6x
  • 1
  • 2
    use `random.random()` that generates a float in `[0;1[` – azro May 15 '22 at 18:06
  • PS: I think, you can't call *Fore.RED*, as it is a string holding the ANSI representation of the red color. You need to print your result like so: `print(Fore.RED + random.sample(numbers, 5) + Fore.RESET)` – ð᠍᠍ May 15 '22 at 18:10

0 Answers0