DiYane

Sorting Hat

Jul 3rd, 2023 (edited)
996
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | Help | 0 0
  1. while True:
  2.     name = input()
  3.  
  4.     if name == "Welcome!":
  5.         print("Welcome to Hogwarts.")
  6.         break
  7.  
  8.     if name == "Voldemort":
  9.         print("You must not speak of that name!")
  10.         break
  11.  
  12.     if len(name) < 5:
  13.         house = "Gryffindor"
  14.     elif len(name) == 5:
  15.         house = "Slytherin"
  16.     elif len(name) == 6:
  17.         house = "Ravenclaw"
  18.     else:
  19.         house = "Hufflepuff"
  20.  
  21.     print(f"{name} goes to {house}.")
  22.  
Advertisement
Add Comment
Please, Sign In to add comment