Programming Super-Challenge Prime Numbers Write a program that does the following task List all of the prime numbers up to a certain number. e.g. prime numbers up to 10 are: 2, 3, 5, 7 (Hide from student if appropriate) Programming Hint: A simpler version of this task is to enter a number and say if it is a prime. A harder version is to add up all of the primes up to a certain number! You can loop a certain number of times using code like this… for num in range (0,10): print (num) …etc... ‘num’ is a variable. This code would loop ten times (from 0 to 9!) and display 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 The numbers in the brackets could be variables too. The percent symbol (%) can be used to give the remainder of a division sum, e.g. 10%2 = 0 (10 divided 2 = 5 remainder 0) e.g. 10%3 = 1 (10 divided 3 = 3 remainder 1)
© Copyright 2026 Paperzz