Advertisement
PowerCell46

Harry Potter task Python

Dec 23rd, 2022
768
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. print_output = True
  2. while True:
  3.     current_name = str(input())
  4.     if current_name == "Welcome!":
  5.         break
  6.     elif current_name == "Voldemort":
  7.         print("You must not speak of that name!")
  8.         print_output = False
  9.         break
  10.     name_length = len(current_name)
  11.     if name_length < 5:
  12.         print(f'{current_name} goes to Gryffindor.')
  13.     elif name_length == 5:
  14.         print(f'{current_name} goes to Slytherin.')
  15.     elif name_length == 6:
  16.         print(f'{current_name} goes to Ravenclaw.')
  17.     elif name_length > 6:
  18.         print(f'{current_name} goes to Hufflepuff.')
  19.  
  20. if print_output == True:
  21.     print("Welcome to Hogwarts.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement