Rushi's Project

 print("This is a program  to find classmate's name according to their roll no.")


name=input("Enter your name:\n")         #User's name

print("Hello "+name+", Welcome to this program.\n\n")

classmates={"1":"Aliza\n Female \n CS~Bio",       #Dictionary

            "2":"Haney\n Female\n CS~Bio",

            "3":"Om\n Gender ERROR\n Subject ERROR",

            "4":"Diraq\n Male\n CS~Maths",

            "5":"Dhruv\n Male\n CS~Bio",

            "6":"Rushi\n Male\n CS~Maths",

            "7":"Rutva\n Female\n CS~Maths",

            "8":"Dweep\n Male\n CS~Maths",

            "9":"Tanisha\n Female\n CS~Bio",

            "10":"Taniya\n Female\n CS~Bio",

            "20":"Agasti\n Female\n Hindi~Bio",

            "22":"Laxmita\n Female\n Hindi~Maths",

            "24":"Vidhi\n Female\n Hindi~Bio",

            "25":"Vidhya\n Female\n Hindi~Bio"}


print("Type any Roll no. from this given list: ",classmates.keys())    

roll=input("Enter roll no.:\n")      

print(classmates.get(roll))    # .get method to avoid errors on random inputs by user.


print("\nThanks for visiting, "+name+" .Run this code again to restart the program.")

Comments

Some of my more interesting posts...

Is it true that homeless and superstars are the same?

Displaying Total sales amount, discount amount and net sales amount by using if~elif statements

Program on a shopping website using Dictionary.