0

Could You advice how to update code without repeating the previous value.

import random
import time

while True :
    a=(random.randint(1,5))
    #print("Number = "+str(a))
    time.sleep(0.8)
    if a == 1:
        print("1")
    if a == 2:
        print("2")
    if a == 3:
        print("3")
    if a == 4:
        print("4")
    if a == 5:
        print("5")

example

djmcg
  • 11
  • 5

0 Answers0