Professional Documents
Culture Documents
While: Print Print Print Print
While: Print Print Print Print
In [21]:
print("*************************************************************************\n")
print("\nWELCOME TO STEADLTER STATIONERIES\n\n")
print("*************************************************************************\n")
print("\nPLEASE ENTER THE DETAILS BELOW")
n=1
while n==1:## Name Validation
name=input("\nNAME : ")
if name.strip().isalpha():
break;
else:
print ("Invalid Name, Please Enter Again")
n=1
while n==1:## Phone Number Validation
if p==6:
break; #to break out of loop and print final bill
else :
elif p == 2:
l1.append(list1[1])
l2.append(q)
print("\nThe product chosen is ",list1[1])
print("Cost is ",list2[1])
localhost:8888/notebooks/Documents/python/lab1.ipynb 2/6
5/27/2020 lab1 - Jupyter Notebook
tot=q*list2[1]
elif p == 3:
l1.append(list1[2])
l2.append(q)
print("\nThe product chosen is ",list1[2])
print("Cost is ",list2[2])
tot=q*list2[2]
elif p == 4:
l1.append(list1[3])
l2.append(q)
print("\nThe product chosen is ",list1[3])
print("Cost is ",list2[3])
tot=q*list2[2]
elif p == 5:
l1.append(list1[4])
l2.append(q)
print("\nThe product chosen is ",list1[4])
print("Cost is ",list2[4])
tot=q*list2[2]
#if else conditional check for discounts
if(tot>=100 and tot<500):
print("\n5% discount provided ")
d=(5/100)*tot
tot=tot-d
l3.append(tot)
elif(tot>=500 and tot<1000):
print("\n15% discount provided ")
d=(15/100)*tot
tot=tot-d
l3.append(tot)
elif(tot>=1000):
print("\n25% Discount Provided ")
d=(25/100)*tot
tot=tot-d
l3.append(tot)
else: l3.append(tot)
print("Your Amount is : ",tot)
totamt=totamt+tot #Amount after discount
print("=============================================================================")
print(" FINAL BILL ")
print("=============================================================================\n\n")
print("NAME OF CUSTOMER : ",name)
print("\nCONTACT NUMBER : ",phone)
print("\n\n")
print("\nItems\t\t\tQuantity\t\tAmount(after discount)")
length=len(l1)
for i in range(length): #for loop to Print the final bill
print("\n{}\t\t\t{}\t\t\t{}".format(str(l1[i]),str(l2[i]),str(l3[i]))) #format function
print("\nFINAL AMOUNT TO BE PAID IS : ",totamt) #final amount after purchase of all product
print("============================================================================")
*************************************************************************
localhost:8888/notebooks/Documents/python/lab1.ipynb 3/6
5/27/2020 lab1 - Jupyter Notebook
*************************************************************************
NAME : sar23
Invalid Name, Please Enter Again
NAME : Sarah
1. Pencils : 100 rs
2. Crayons : 250 rs
3. Paints : 500 rs
4. Pen : 140 rs
5. Books : 300 rs
6. To Exit and Print Final Bill
1. Pencils : 100 rs
2. Crayons : 250 rs
3. Paints : 500 rs
4. Pen : 140 rs
5. Books : 300 rs
6. To Exit and Print Final Bill
5% discount provided
Your Amount is : 95.0
1. Pencils : 100 rs
2. Crayons : 250 rs
3. Paints : 500 rs
4. Pen : 140 rs
5. Books : 300 rs
localhost:8888/notebooks/Documents/python/lab1.ipynb 4/6
5/27/2020 lab1 - Jupyter Notebook
1. Pencils : 100 rs
2. Crayons : 250 rs
3. Paints : 500 rs
4. Pen : 140 rs
5. Books : 300 rs
6. To Exit and Print Final Bill
crayons 3 637.5
pencils 1 95.0
books 3 1125.0
In [ ]:
In [ ]:
localhost:8888/notebooks/Documents/python/lab1.ipynb 5/6