[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

So I was given this question to be solved in Python 3 : Pick any 3 random ascending numbers and write out a loop function that prints out all 3 numbers. This was the code and solution presented to me. Can anyone understand it and explain it to me please ? I have looked at it but cannot see how it was derived and why the correct solution was printed. Thanks alot ! # any 3 ascending numbers , counter must start at 0. # 400 467 851 i = 0 x = 400 while x < 852: print(x) if i > 0: x = x + ((i + 4) * 67) + (i * 49) else: x = x + 67 i = i + 1

- Prev by Date:
**sampling from frequency distribution / histogram without replacement** - Next by Date:
**3 random numbers** - Previous by thread:
**sampling from frequency distribution / histogram without replacement** - Next by thread:
**3 random numbers** - Index(es):