keyboard_arrow_left keyboard_arrow_right
Vaishanth's Project

The Sorting Hat

About Vaishanth

I am Vaishanth J V studying grade 7 from National Public School, Banashankari

My interests include cubing, coding, reading and watching thriller movies

I am also very fascinated by science and enjoy learning deeper aspects of quantum physics, relativity, orbital concepts of elements, astronomy, and evolution.

Vaishanth's project details:

This is a Sorting Hat Quiz based on Harry Potter series. A Sorting Hat decides, which one of the Hogwarts houses you are in. The four houses are Slytherin, Ravenclaw, Hufflepuff, and Gryffindor. This quiz will sort you into one of the houses based on your answers to the question.

import random
slytherin_points = 0
ravenclaw_points = 0
gryffindor_points = 0
hufflepuff_points = 0
questions = ['''Which of the following would you most hate people to call you?
    a)Ordinary
    b)Ignorant
    c)Cowardly
    d)Selfish''','''After you have died, what would you most like people to do when they hear your name?
    a)I don't care what people think of me after I'm dead; it's what they think of me while I'm alive that counts
    b)Think with admiration of your achievements
    c)Ask for more stories about your adventures
    d)Miss you, but smile''','''Given the choice, would you rather invent a potion that would guarantee you:
    a)Power
    b)Wisdom
    c)Glory
    d)Love''','''How would you like to be known to history?
    a)The Great
    b)The Wise
    c)The Bold
    d)The Good''','''You enter an enchanted garden. What would you be most curious to examine first?
    a)The bubbling pool, in the depths of which something luminous is swirling
    b)The silver leafed tree bearing golden apples
    c)The statue of an old wizard with a strangely twinkling eye
    d)The fat red toadstools that appear to be talking to each other''','''Four boxes are placed before you. Which would you try and open?
    a)The gleaming jet black box with a silver lock and key, marked with a mysterious rune that you know to be the mark of Merlin.
    b)The ornate golden casket, standing on clawed feet, whose inscription warns that both secret knowledge and unbearable temptation lie within.
    c)The small pewter box, unassuming and plain, with a scratched message upon it that reads ˜I open only for the worthy.
    d)The small tortoiseshell box, embellished with gold, inside which some small creature seems to be squeaking.''',
    '''One of your house mates has cheated in a Hogwarts exam by using a Self-Spelling Quill. Now he has come top of the class in Charms,
beating you into second place. Professor Flitwick is suspicious of what happened. He draws you to one side after his lesson and asks
you whether or not your classmate used a forbidden quill. What do you do?
    a)You would not wait to be asked to tell Professor Flitwick the truth. If you knew that somebody was using a forbidden quill, you would tell the teacher
    before the exam started.
    b)Tell Professor Flitwick the truth. If your classmate is prepared to win by cheating, he deserves to be found out. Also, as you are both in the same house,
    any points he loses will be regained by you, for coming first in his place.
    c)Tell Professor Flitwick that he ought to ask your classmate (and resolve to tell your classmate that if he doesn't tell the truth, you will).
    d)Lie and say you don't know (but hope that somebody else tells Professor Flitwick the truth).''',
'''You and two friends need to cross a bridge guarded by a river troll who insists on fighting one of you before he will let all of you pass. Do you:
    a)Attempt to confuse the troll into letting all three of you pass without fighting?
    b)Suggest that all three of you should fight (without telling the troll)?
    c)Volunteer to fight?
    d)Suggest drawing lots to decide which of you will fight?''','''Late at night, walking alone down the street, you hear a peculiar cry that you believe to have a magical source. Do you:
    a)Proceed with caution, keeping one hand on your concealed wand and an eye out for any disturbance?
    b)Withdraw into the shadows to await developments, while mentally reviewing the most appropriate defensive and offensive spells, should trouble occur?
    c)Draw your wand and try to discover the source of the noise?
    d)Draw your wand and stand your ground?''','''Four goblets are placed before you. Which would you choose to drink?
    a)The mysterious black liquid that gleams like ink, and gives off fumes that make you see strange visions.
    b)The foaming, frothing, silvery liquid that sparkles as though containing ground diamonds.
    c)The golden liquid so bright that it hurts the eye, and which makes sunspots dance all around the room.
    d)The smooth, thick, richly purple drink that gives off a delicious smell of chocolate and plums.''']
print('''Welcome to the sorting hat quiz!There will be 10 questions.Each question will have 4 options.
you have to pick one of the four options.You should only answer with a,b,c or d.In the end based on
your answers the sorting hat will decide which house you belong to.''')
print("             ")
print("             ")      
question_num = 1
while question_num<=10:
    current_question = random.choice(questions)
    print("Q"+str(question_num)+")"+current_question)
    questions.remove(current_question)
    answer = "n"
    while answer not in ("a","b","c","d"):
        answer = input("Only answer with a,b,c, or d: ")
        answer = answer.lower()
        if answer=="a":
            slytherin_points = slytherin_points + 1
        elif answer=="b":
            ravenclaw_points = ravenclaw_points + 1
        elif answer=="c":
            gryffindor_points = gryffindor_points + 1
        elif answer=="d":
            hufflepuff_points = hufflepuff_points + 1
    print("             ")
    question_num = question_num + 1

slytherin_speech = '''Congrats!You were sorted into Slytherin!
    Slytherin houses wizards such as Severus Snape, Horace Slughorn,Draco Malfoy
    and even the great Merlin. Slytherins are cunning,ambitious,determined and resourceful.The founder of this house
    is Salazar Slytherin.Their house ghost is The Bloody Baron.Their colors are green and silver. Their house mascot is a snake.
    The Slytherin common room is in the dungeons of Hogwarts Castle and underneath the Black Lake. Because of this, the light in
    the common room is green.To enter the Slytherin common room one must merely speak aloud the current password in front of a
    stretch of a damp stone wall; once the word is uttered a concealed stone door will slide aside leaving a rectangular hole
    in the wall leading to the Slytherin common room.'''
gryffindor_speech = '''Congrats!You were sorted into Gryffindor!
    Gryffindor wizards such as Albus Dumbledore, Harry Potter
    and Neville Longbottom. Gryffindors are brave and chivalrous.The founder of this house is Godric Gryffindor.
    Their house ghost is Nearly Headless Nick.Their colors are red and gold. Their house mascot is a lion.
    The Gryffindor Common Room is located in one of the castle's towers (Gryffindor Tower), the entrance to which is located
    on the seventh floor and is guarded by an oil painting of the Fat Lady, who is garbed in a pink silk dress.
    She permits entry only after being given the correct (regularly changing) password. Behind her painting is a large common room,
    with a fireplace, and two staircases leading up to the girls' and boys' dormitories.
'''
ravenclaw_speech = '''Congrats!You were sorted into Ravenclaw!
    Ravenclaw houses wizards such as Luna Lovegood,Cho Chang, and Penelope Clearwater.
    Ravenclaws are wise,curious and knowledgeable. The founder of this house is Rowena Ravenclaw. Their house ghost is the
    Grey Lady.Their colors are blue and bronze. Their house mascot is a eagle.The Ravenclaw common room is in one of the
    castle's towers and is wide and circular. You have to climb a tight spiral staircase to get there. It has graceful arched
    windows, and the walls are hung with blue and bronze silks. The domed ceiling is painted with stars, which are echoed in
    the midnight-blue carpet. Tables, chairs, and bookcases cover the expanse of the floor, and a white marble statue of
    Rowena Ravenclaw sits next to the door that leads to the dormitories above.Unlike the other common rooms in the school,
    a logical riddle given by a bronze eagle-shaped knocker must be answered to enter.This could prove troublesome as anyone
    with enough intellect could intrude into the dormitory.
'''
hufflepuff_speech = '''Congrats!You were sorted into Hufflepuff!
    Hufflepuff houses wizards such as Nymphadora Tonks and Cedric Diggory.
    Hufflepuffs are loyal,hardworking abd accepting.The founder of this house is Helga Hufflepuff. Their house ghost is
    the Fat Friar.Their colors are yellow and black. Their house mascot is a badger.The Hufflepuff dormitories and
    common room have never been seen by outsiders and is the only house with repelling devices in case of intruders.
    They are accessed through a pile of large barrels, found stacked in a shadowy stone recess on a right-hand side
    corridor near the kitchens. The barrel two from the bottom, middle of the second row, will open if tapped in
    the rhythm of Helga Hufflepuff.However, once you make it through the tunnel entryway, the Hufflepuff dormitory
    is a quite cosy and welcoming place; it always feels sunny. The common room is a large, earthy, round room with
    low ceilings. The view from the round windows is of dandelions and rippling grass.
'''
#Slytherin
if slytherin_points>hufflepuff_points and slytherin_points>ravenclaw_points and slytherin_points>gryffindor_points:
    print(slytherin_speech)
#Gryffindor  
elif gryffindor_points>hufflepuff_points and gryffindor_points>ravenclaw_points and gryffindor_points>slytherin_points:
    print(gryffindor_speech)
#Ravenclaw  
elif ravenclaw_points>hufflepuff_points and ravenclaw_points>slytherin_points and ravenclaw_points>gryffindor_points:
    print(ravenclaw_speech)
#Hufflepuff  
elif hufflepuff_points>slytherin_points and hufflepuff_points>gryffindor_points and hufflepuff_points>ravenclaw_points:
    print(hufflepuff_speech)
#Slytherpuff
elif slytherin_points==hufflepuff_points and slytherin_points>gryffindor_points and slytherin_points>ravenclaw_points:
    print('''The sorting hat has come to a stall between Hufflepuff and Slytherin.Which one do you prefer?
        a)Slytherin
        b)Hufflepuff''')
    house = "n"
    while house not in ("a","b",):
        house = input('''Only answer with a or b: ''')
        house = house.lower()
        print("           ")
        if house=="a":
            print(slytherin_speech)
        elif house=="b":
            print(hufflepuff_speech)         
#Slytherclaw    
elif slytherin_points==ravenclaw_points and slytherin_points>gryffindor_points and slytherin_points>hufflepuff_points:
    print('''The sorting hat has come to a stall between Slytherin and Ravenclaw.Which one do you prefer?
        a)Slytherin
        b)Ravenclaw''')
    house = "n"
    while house not in ("a","b",):
        house = input('''Only answer with a or b: ''')
        house = house.lower()
        print("           ")
        if house=="a":
            print(slytherin_speech)
        elif house=="b":
            print(ravenclaw_speech)     
#Slythindor    
elif slytherin_points==gryffindor_points and slytherin_points>hufflepuff_points and slytherin_points>ravenclaw_points:
    print('''The sorting hat has come to a stall between Slytherin and Gryffindor.Which one do you prefer?
        a)Slytherin
        b)Gryffindor''')
    house = "n"
    while house not in ("a","b",):
        house = input('''Only answer with a or b: ''')
        house = house.lower()
        print("           ")
        if house=="a":
            print(slytherin_speech)
        elif house=="b":
            print(gryffindor_speech)     
#Gryffinpuff    
elif gryffindor_points==hufflepuff_points and gryffindor_points>slytherin_points and gryffindor_points>ravenclaw_points:
    print('''The sorting hat has come to a stall between Hufflepuff and Gryffindor.Which one do you prefer?
        a)Gryffindor
        b)Hufflepuff''')
    house = "n"
    while house not in ("a","b",):
        house = input('''Only answer with a or b: ''')
        house = house.lower()
        print("           ")
        if house=="a":
            print(gryffindor_speech)
        elif house=="b":
            print(hufflepuff_speech)     
#Gryffinclaw    
elif gryffindor_points==ravenclaw_points and ravenclaw_points>hufflepuff_points and ravenclaw_points>slytherin_points:
    print('''The sorting hat has come to a stall between Gryffindor and Ravenclaw.Which one do you prefer?
        a)Gryffindor
        b)Ravenclaw''')
    house = "n"
    while house not in ("a","b",):
        house = input('''Only answer with a or b: ''')
        house = house.lower()
        print("           ")
        if house=="a":
            print(gryffindor_speech)
        elif house=="b":
            print(ravenclaw_speech)         
#Huffleclaw    
elif hufflepuff_points==ravenclaw_points and slytherin_points < hufflepuff_points and gryffindor_points < hufflepuff_points:
    print('''The sorting hat has come to a stall between Hufflepuff and Ravenclaw.Which one do you prefer?
        a)Ravenclaw
        b)Hufflepuff''')
    house = "n"
    while house not in ("a","b",):
        house = input('''Only answer with a or b: ''')
        house = house.lower()
        print("           ")
        if house=="a":
            print(ravenclaw_speech)
        elif house=="b":
            print(hufflepuff_speech)
print("           ")
slytherin_percentage = (slytherin_points/10)*100
ravenclaw_percentage = (ravenclaw_points/10)*100
gryffindor_percentage = (gryffindor_points/10)*100
hufflepuff_percentage = (hufflepuff_points/10)*100
print('''Final scores:
Slytherin:''',slytherin_percentage,"%")
print("Ravenclaw:",ravenclaw_percentage,"%")
print("Hufflepuff:",hufflepuff_percentage,"%")
print("Gryffindor:",gryffindor_percentage,"%")
                                           
Name: Vaishanth J V
Grade: 7

Videos

Solving of 2x2 Rubik's cube

Reciting of all 118 elements in order of their atomic numbers

First fifty digits of pi

Achivements

Be the Next Creator like :

  It was a good interactive course with practicals and I enjoyed the course.The teacher was very good. At each step she made sure that I understood the concepts and took the feedback
Parents of Vaishanth J V