Spread Firefox Affiliate Button

Friday, February 25, 2011

Python

#/usr/bin/python
""" Global Declaration of List for Student name and Roll No"""
name = [] #list declaration
rollno = []

""" Getting user input """

u_input_no = input ("Enter the number of input:")

#Starting the function get() to get the student details from the user

def get():
s_name = raw_input("Enter The Name:") # Getting the student Name
name.append(s_name) # add it to the name list
s_roll_no = input ("Enter the Roll number:") # Getting the Student roll number
rollno.append(s_roll_no) # Adding it to roll number list
# Starting the fuction display() to display the inputs stored in the list

def display():
for x in range(u_input_no): # for loop started to display the name and roll number 1/1
print "Name: ",name[x]
print "Roll No:",rollno[x]

for i in range(u_input_no):
get()
else:
display()

No comments:

Post a Comment

About Me

My photo
Well.. I'm a Friendly hearted Guy. Going to complete my Engineering. Well I'm a great Linux Lover and want to achieve lot of things in Linux.