Advertisement
boyan1324

23401

Feb 1st, 2024
563
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. sum_of_odd = 0
  2. counter = 0
  3. while True:
  4.     command = input("Enter a number or type 'END' to finish: ")
  5.     if command == "END":
  6.         print(sum_of_odd)
  7.         break
  8.     command = int(command)
  9.     if counter <= 5:
  10.         if command % 2 != 0:
  11.             sum_of_odd += command
  12.         counter += 1
  13.     elif command == "END":
  14.         print(sum_of_odd)
  15.         break
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement