element = -1 c = input() nc = input() while element != str: element = input() if (element % 2) == 0: c =+ 1 elif (element % 2) == 1: nc =+ 1 print("Четных: " + c) print("Нечетных: " + nc) 

Writes that:

Traceback (most recent call last): File "/home/feironox5/PycharmProjects/untitled1/hjh.py", line 6, in if (element% 2) == 0: TypeError: not all arguments during string formatting

  • What is your question? - kot-da-vinci

1 answer 1

It's simple. The fact is that input returns a string. In this case, you need to use int(input) Here is the correct code:

 element = -1 c = int(input()) nc = int(input()) while element != str: element = int(input()) if (element % 2) == 0: c =+ 1 elif (element % 2) == 1: nc =+ 1