GeorgiLukanov87

even_odd_sum_funct

Jun 18th, 2022 (edited)
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. def odd_even_sum(numbers: str):
  2.     odd_sum = 0
  3.     even_sum = 0
  4.     for number in numbers:
  5.         if int(number) % 2 == 0:
  6.             even_sum += int(number)
  7.         else:
  8.             odd_sum += int(number)
  9.     string_result = f"Odd sum = {odd_sum}, Even sum = {even_sum}"
  10.     return string_result
  11.  
  12.  
  13. number_data = input()
  14. print(odd_even_sum(number_data))
Add Comment
Please, Sign In to add comment