Advertisement
ABIX_Edukacja

klub_mlodego_programisty_sp

Feb 5th, 2022
1,532
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. # skrypt z instrukcjami warunkowymi i blokami kodu
  2.  
  3. actual_year = 2021
  4.  
  5. print("Hi, we'll try to compute your age ;-)")
  6. name = input("Please tell me your name:")
  7. birth = input(f"OK {name} - at what year have you birth?")
  8. birth = int(birth)
  9. age = actual_year - birth
  10.  
  11. if age >= 18:
  12.     print(f"Oh, I see, {name} - you are an adult now.")
  13.     print(f"You are {age} years old.")
  14. else:
  15.     print(f"You are young - {age} years old.")
  16.  
  17.  
  18. if name.endswith("a"):
  19.     print(f"I guess {name} - you are a woman.")
  20.     if name.lower() == "barnaba":
  21.         print(f"But your name: {name} is an exception - you are a man!")
  22. else:
  23.     print("You probably are a man...")
  24.  
  25. print("That is all - see you next time!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement