Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.
One possible program:
import random
count = 0
while True:
roll = random.randint(1, 10)
count += 1
print(roll)
if roll == 7:
break
print("It took", count, "attempts")