[Tutor] (no subject)

Abdullahi Farah Mohamud AbdullahiFarah.Moham at claremont-high.org.uk
Thu Dec 18 22:10:40 CET 2014


hello i need help with a program and i dont understand what is wrong
it is a lottery ticket generator.
the problem is:
when the computers asks the user if he would like to go again and the user says yes, it asks for the number of lines and then if the user clicks 3 it will only give me one line.
here is the code
appreciate if you could help


import random
abz = 0
lines = int(input('How many lines would you like?'))
loop = lines
if lines >7:
    print('Too many lines saaxib')
    exit()
else:
    print()
while lines != 0:
    line1 = random.randint (1,7)
    line2 = random.randint (8,14)
    line3 = random.randint (15,21)
    line4 = random.randint (22,28)
    line5 = random.randint (29,35)
    line6 = random.randint (36,42)
    line7 = random.randint (43,49)
    lines = lines - 1
    print(line1, line2, line3, line4, line5, line6,line7)
while abz == 0:
    again = input('Would you like to go again?')
    if again == 'yes':
        lines = int(input('How many lines would you like?'))






    line1 = random.randint (1,7)
    line2 = random.randint (8,14)
    line3 = random.randint (15,21)
    line4 = random.randint (22,28)
    line5 = random.randint (29,35)
    line6 = random.randint (36,42)
    line7 = random.randint (43,49)
    lines = lines - 1
    print(line1, line2, line3, line4, line5, line6,line7)

    if again == 'no':
        print('Okay the program is finished saaxib')
        exit()


More information about the Tutor mailing list