Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- command = input()
- sum_prime = 0
- sum_nonprime = 0
- while command != "stop":
- number = int(command)
- counter = 0
- if number < 0:
- print("Number is negative.")
- else:
- for i in range(1, number+1):
- if number % i == 0:
- counter +=1
- if counter == 2:
- sum_prime += number
- else:
- sum_nonprime += number
- command = input()
- print(f"Sum of all prime numbers is: {sum_prime}")
- print(f"Sum of all non prime numbers is: {sum_nonprime}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement