Advertisement
Guest User

Untitled

a guest
Oct 9th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. def lainaa(quote, totuus = True):
  2. """Lainaa-funktio on kaksiparametrinen ja se palauttaa käyttäjän syötteen
  3. kaksinkertaisissa lainausmerkeissä, kun arvo on True ja
  4. yksinkertaisissa lainausmerkeissä, kun arvo on False. Paluuarvot ovat
  5. True kohdassa lainaa(quote, True) ja False kohdassa lainaa(quote, False)."""
  6. if totuus == True:
  7. quotetrue = '"' + quote + '"'
  8. return quotetrue
  9. elif totuus == False:
  10. quotefalse = "'" + quote + "'"
  11. return quotefalse
  12.  
  13.  
  14. def main():
  15. print("You say, I quote.")
  16. print("Please, say something:")
  17. quote = str(input())
  18. tuloste = lainaa(quote, True)
  19. print("You said:",tuloste)
  20. tuloste = lainaa(quote, False)
  21. print("You said:",tuloste)
  22.  
  23.  
  24. # Kutsutaan pääohjelmaa, jos ohjelmaa ajetaan.
  25. if __name__ == "__main__":
  26. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement