How to create a dice for ludo | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

How to create a dice for ludo

The dice should roll a random number between range (1,6) and if it's 6 it should roll a random number again and if it's 3 6's in a row then stop.

4th Aug 2020, 9:25 AM
Thrishong Sherpa
Thrishong Sherpa - avatar
5 Antworten
+ 5
Show us your attempt first, then we can help you.
4th Aug 2020, 9:26 AM
Rowsej
Rowsej - avatar
+ 1
import random min = 1 max = 6 value = (random.randint(min,max)) print(value) while (value) == max: print("Rolling again...") print(random.randint(min,max)) break
4th Aug 2020, 9:44 AM
Thrishong Sherpa
Thrishong Sherpa - avatar
+ 1
i could only get it to roll twice and i am stuck here
4th Aug 2020, 9:45 AM
Thrishong Sherpa
Thrishong Sherpa - avatar
+ 1
import random min = 1 max = 6 value = (random.randint(min,max)) print(value) while (value) == max: print("Rolling again...") value = (random.randint(min,max)) print(value) if value == 6: print("Rolling again") value = (random.randint(min,max)) print(value) elif value == 6: print("Oops") else: print("Nice") so i made these changes and it seems to work? lol idk for sure coz i tried rolling a couple times but never got 3 6's lol... anyway thanks alot for ur help Rowsej.
4th Aug 2020, 10:08 AM
Thrishong Sherpa
Thrishong Sherpa - avatar