Advertisement
RavenChrstn

Untitled

Sep 24th, 2021
725
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. import math
  2. final = 0
  3. x = int(input())
  4. y = int(input())
  5. if x > y:
  6.     for num in range(x, y-1, -1):
  7.         print(num)
  8.         if num != x and num != y:
  9.             if num % 2 != 0:
  10.                 final += num
  11. elif x < y:
  12.     for num in range(x, y+1):
  13.         print(num)
  14.         if num != x and num != y:
  15.             if num % 2 != 0:
  16.                 final += num
  17. print(final)
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement