In [ ]:
from random import randrange
for _ in range(7):
generated_number = randrange(-10, 60)
print('Generated number: {}'.format(generated_number))
if generated_number < 0:
continue
if generated_number >= 50:
break
print('\tUnless it is a single digit, will determine what it is equal to modulo 4')
if generated_number < 10:
pass
elif generated_number % 4 == 1:
print('\tEqual to one modulo four')
elif generated_number % 4 == 2:
print('\tEqual to two modulo four')
elif generated_number % 4 == 3:
print('\tEqual to three modulo four')
else:
print('\tDivisible by four')
else:
print('No number greater than 49 has been generated')
In [ ]:
from random import randrange
count_down = 7
while count_down:
count_down -= 1
generated_number = randrange(-10, 60)
print('Generated number: {}'.format(generated_number))
if generated_number < 0:
continue
if generated_number >= 50:
break
print('\tUnless it is a single digit, will determine what it is equal to modulo 4')
if generated_number < 10:
pass
elif generated_number % 4 == 1:
print('\tEqual to one modulo four')
elif generated_number % 4 == 2:
print('\tEqual to two modulo four')
elif generated_number % 4 == 3:
print('\tEqual to three modulo four')
else:
print('\tDivisible by four')
else:
print('No number greater than 49 has been generated')
In [ ]:
for x, y in zip((range(5)), (range(5, 0, -1))):
print(x, y, end = '\t') if x > y else print(y, x, end = '\t')
print('\n')
for x in range(5):
for y in range(5, 0, -1):
print(x, y, end = '\t') if x > y else print(y, x, end = '\t')
print()