I am trying to make a little minigame, where you can roll 6 dices, next you will be asked which dice kind you want to keep, lets say it generated this:
1,1,2,5,1,3
Now I want to user to for instance select the number 1 via raw_input, and let him roll again untill the he gets no more dices of the number 1
How do I let the user select the number he wants and let him roll again? (correct me if I am not asking to right question, I am still learning python)
import os
os.system('clear')
print (20 * '-')
print (" dobbelsteen gooien")
print (20 * '-')
print ("1. Spel spelen")
print ("2. Stoppen")
print (20 * '-')
keuze = raw_input("Kies uit 1 of 2: ")
os.system('clear')
keuze = int(keuze)
if keuze == 1:
import random
for roll in xrange(6):
dobbel = random.randint(1,6)
if dobbel == 1:
print "1"
if dobbel == 2:
print "2"
if dobbel == 3:
print "3"
if dobbel == 4:
print "4"
if dobbel == 5:
print "5"
if dobbel == 6:
print "6"
Een = 0
Twee = 0
Drie = 0
Vier = 0
Vijf = 0
Zes = 0
Zeven = 0
Acht = 0
Negen = 0
Tien = 0
Elf = 0
Twaalf = 0
print (20 * '-')
dobbel1 = input("Welke dobbelsteen wil je houden?: ")
if dobbel == 1 and dobbel1 == 1:
Een = +1
print "Je hebt nu %s van Een" % (dobbel)
Aucun commentaire:
Enregistrer un commentaire