-1

Here is the program below which is possible for entered tuple but i need to take input n numbers in tuple and pass it to function to count how can i do that?

def CountOfEvenOddOddNumbers(evodTuple):
tEvenCount = tOddCount = 0
for oetup in evodTuple:
    if(oetup % 2 == 0):
        tEvenCount = tEvenCount + 1
    else:
        tOddCount = tOddCount + 1
return tEvenCount, tOddCount

evodTuple =(12, 26, 77, 99, 66, 75, 14, 256, 19, 81, 11, 33)
print("Even and Odd Tuple Items = ", evodTuple)

evenCount, oddCount = CountOfEvenOddOddNumbers(evodTuple)
print("The Count of Even Numbers in evodTuple = ", evenCount)
print("The Count of Odd  Numbers in evodTuple = ", oddCount)
  • 2
    Does this answer your question? [How to read keyboard-input?](https://stackoverflow.com/questions/5404068/how-to-read-keyboard-input) – Taxel Sep 15 '21 at 15:26
  • 1
    In addition to the last comment, the body of your function is misindented. And is [conventional](https://www.python.org/dev/peps/pep-0008/) to use `snake_case` in function and variables naming. – Héliton Martins Sep 15 '21 at 15:31

1 Answers1

0
inList = list(map(int, input("Enter numbers seperated by a space: ").split()))

This gets space-separated values as input from the user and adds them to a list.

KavG
  • 169
  • 1
  • 12