Advertisement
tuomasvaltanen

Untitled

Sep 24th, 2020 (edited)
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. # KOODIPAJA 2
  2.  
  3. print("Tervetuloa koodipajaan 24.9.2020!")
  4.  
  5. # tämän voisi pyytää käyttäjältä
  6. coins = 97
  7.  
  8. # tapa 1
  9. cents50 = coins / 50
  10. cents50 = int(cents50)
  11. coins = coins - (cents50 * 50)
  12.  
  13. print(f"50snt kolikot: {cents50}")
  14. print(f"Jäljelle jää {coins} snt")
  15.  
  16. coins = 97
  17.  
  18. # tapa 2
  19. cents50 = coins / 50
  20. cents50 = int(cents50)
  21. coins = coins % 50
  22.  
  23. print(f"50snt kolikot: {cents50}")
  24. print(f"Jäljelle jää {coins} snt")
  25.  
  26. # tapa 3
  27. coins = 97
  28.  
  29. cents50 = coins // 50
  30. coins = coins % 50
  31.  
  32. print(f"50snt kolikot: {cents50}")
  33. print(f"Jäljelle jää {coins} snt")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement