So I want a font to be red if a condition is true, but otherwise print in green font. Look at the code down below for an example.
#if Money is greater than or equal to 0, then the font color will be green. Otherwise, the font color will be red.
from colorama import Fore
Cash = int(input("Enter random number here (This is how much money a player has)"))
print("Money: ", if (Cash) >= 0: Fore.GREEN + (Cash), else: Fore.RED + (Cash))
#this does not work on python, is there a way you can fix this?
#If I input a positive number, I get a green font.
#If I input a negative number, I get a red font.
#The output only says "SyntaxError: invalid syntax"
Aucun commentaire:
Enregistrer un commentaire