Script
#!/usr/local/bin/python3.7
print()
maximum = int(input("Enter the maximum number you are checking for in the prime list: "))
for x in range(1, maximum + 1):
for trailfactor in range(2, x):
if x % trailfactor == 0:
break
else:
print(x, end = ' ')
print()
print()
Execution
Enter the maximum number you are checking for in the prime list: 73
1 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73
#!/usr/local/bin/python3.7
print()
maximum = int(input("Enter the maximum number you are checking for in the prime list: "))
for x in range(1, maximum + 1):
for trailfactor in range(2, x):
if x % trailfactor == 0:
break
else:
print(x, end = ' ')
print()
print()
Execution
Enter the maximum number you are checking for in the prime list: 73
1 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73
No comments:
Post a Comment