New to programming, for practice I’m attempting to program the I-Ching oracle.
I’m getting the output I want, but only by copying this code block into my program 6 times.
Is there a loop condition I can set to make this more concise?
I’ve read the docs and tuts on looping but haven’t seen how it could be applied in this context.
import random
oracle = random.randint(6,9)
if oracle == 6:
print "__ __~"
elif oracle == 7:
print "_____"
elif oracle == 8:
print "__ __"
elif oracle == 9:
print "_____~" (X6)
=>
this is the output I am getting:
_____
__ __
__ __~
_____
_____~
__ __
You could use a while loop like this: