Answer to Question #247113 in Computer Networks for Licinda Wait

Question #247113
# Format the background colour of currentPriceLabel as follows:
# - If currentPrice > previousPrice: set currentPriceLabel background colour to green
# - If currentPrice < previousPrice: set currentPriceLabel background colour to red
# - If currentPrice == previousPrice: set currentPriceLabel background colour to blue
1
Expert's answer
2021-10-05T23:13:22-0400
from colorama import Fore, Back, Style
currentPrice = 14
previousPrice=20

if(currentPrice > previousPrice):
    print(Back.GREEN + 'current Price greater ')
else:
    if(currentPrice < previousPrice):
        print(Fore.RED + 'previous price is greater')
    else:
        if(currentPrice == previousPrice):
            print(Fore.BLUE + 'current price and previous price are equal')
print(Style.RESET_ALL)
print('back to normal now')

Output:


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS