I need the user input to specify the amount of numbers to be printed in the range.
I have the following code for that:
i = 0;
start_char = 65
end_char = 65
x = input("Enter numbers of plates:")
while (i < int(x)):
if i%26 == 0 and i!= 0:
end_char = (65)
start_char += 1
print((chr(start_char))+(chr(end_char)))
end_char =end_char + 1
i = i + 1
for plate_code in (range(1000)):
print(str(plate_code) + ((chr(start_char))+(chr(end_char))))
You are incrementing i
only inside of if
and since i = 0
initially, your code never enters if
and stucks in an infinite loop.
Move i = i + 1
outside of if
.
while (i < int(x)):
if i%26 == 0 and i!= 0:
end_char = (65)
start_char += 1
print((chr(start_char))+(chr(end_char)))
end_char =end_char + 1
i = i + 1 #move incrementation outside of if
for plate_code in (range(1000)):
print(str(plate_code) + ((chr(start_char))+(chr(end_char))))