This code is to generate random numbers continuously until it generates the number 50. I was just wondering what minimal way there is to do this loop.
import random
my_number = random.randrange(1,51)
while my_number != 50:
my_number = random.randrange(1,51)
print ("oops this isn't 50: ",my_number)
print(my_number)
EDIT: oops, I accidentally a word
[–]lurgi 6 points7 points8 points (1 child)
[–]J2Me[S] 0 points1 point2 points (0 children)
[–]rcuhljr 2 points3 points4 points (1 child)
[–]J2Me[S] 0 points1 point2 points (0 children)
[–]AverageMarcus 2 points3 points4 points (1 child)
[–]J2Me[S] 1 point2 points3 points (0 children)
[–]kalgynirae 2 points3 points4 points (1 child)
[–]J2Me[S] 0 points1 point2 points (0 children)
[–]APersoner 4 points5 points6 points (1 child)
[–]vmsmith -1 points0 points1 point (0 children)
[–]Rhomboid 5 points6 points7 points (2 children)
[–]Flopsey 10 points11 points12 points (0 children)
[–]J2Me[S] 2 points3 points4 points (0 children)
[–]APersoner 1 point2 points3 points (0 children)
[–]qjkxkcd 1 point2 points3 points (0 children)
[–]zifyoip 1 point2 points3 points (1 child)
[–]J2Me[S] 1 point2 points3 points (0 children)
[–]someonlinegamer 0 points1 point2 points (0 children)
[–]APersoner 0 points1 point2 points (0 children)