SHARE
TWEET

zad 1-3

a guest Jan 22nd, 2020 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #zad1
  2. l = int(input("Podaj liczbe"))
  3. if l % 2 == 0:
  4.     print(l / 2)
  5. else:
  6.     print(l)
  7. #zad2
  8. suma = 0
  9. for x in range(4, 8):
  10.     if x % 2 == 0:
  11.         suma += x
  12.     else:
  13.         pass
  14. print(suma)
  15. #zad3
  16. sumaparzystych = 0
  17. sumanieparzystych = 0
  18. for i in range(10, 14):
  19.     if i % 2 == 0:
  20.         sumaparzystych += i
  21.     elif i % 2 != 0:
  22.         sumanieparzystych += i
  23. print("Suma parzystych: " + str(sumaparzystych))
  24. print("Suma nieparzystych: " + str(sumanieparzystych))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top