I need help to check my code from a professional.Also how to convert this into a professional one using Classes and modules?If possible guide me how to convert this code into a GUI application or Android application.Also I am having trouble in getting correct float values.
d = {}
name = raw_input("Please enter item name (or press enter to end input): ")
while name != '':
number = int(raw_input("Please enter cost: "))
d[name] = number
name = raw_input("Please enter item name (or press enter to end input): ")
if name == '':
print("Thank You!\n")
print("Your order contains the following entries:\n",)
for name, number in d.items():
print ("%s %d" % (name, number))
print "\n"
for k, v in d.iteritems():
x=int(raw_input("No. of persons shared %s:"%(k)))
d[k]=float(v/x)
for name, number in d.items():
print ("%s %.2f" % (name, number))
n_pers=int(raw_input("\nEnter number of persons:"))
e={}
for i in range(0,n_pers):
cust = raw_input("Please enter cust name (or press enter to end input): ")
e[cust]=0
for k, v in d.iteritems():
print ("%s %.2f" % (k, v))
y=int(raw_input("Did u had this? Press 1 if yes:"))
if y==1:
e[cust]=e[cust]+v
surcharge=int(raw_input("ExTra Charges:"))
indiv=surcharge/n_pers
for cust, x in e.items():
print ("%s %.2f" % (cust, x+indiv))
0 comments:
Post a Comment