Sunday, 8 January 2017

To make a list of values entered by user

#To make a list of values  entered by user 

#defining list
l=[]

#storing flag in one variable
ch='y'

#giving condition
while ch!='n':
    n=input('enter value:')  #accepting values from user
    ch=input("do u want to continue:") #taking choice from user
    l.append(n)  #appending the values in list

#displaying list
print("list of values:" ,l)

OUTPUT :


No comments:

Post a Comment