Dice Random no

PHOTO EMBED

Fri Nov 26 2021 10:06:16 GMT+0000 (Coordinated Universal Time)

Saved by @Sourabh #list #forloop #for #loop ##dictionary

# Numpy is imported, seed is set

# Starting step
step = 50
# Roll the dice
dice = np.random.randint(1,7)
# Finish the control construct
if dice <= 2 :
    step = step - 1
elif dice <= 5 :
    step = step + 1
else:
    step = step + np.random.randint(1,7)

# Print out dice and step
print(dice)
print(step)
content_copyCOPY