“Bill Python” Kode Jawaban

Bill Python

tprice = 0
tup = [['apple','100','2'],['blackberry','100','23']]
f= open(filename,'w')
g= open('recpt.txt','r')
lines = g.readlines()
for line in lines:
    base = line.split()
    tup.append(base)
print('S.no','\t','Product','\t','Unit','\t','Price')
for i in range(len(tup)):
    if len(tup[i][0]) <= 7:
      print([i+1],'\t',tup[i][0],'\t','\t',tup[i][2],'\t',tup[i][1])
    else:
        print([i+1], '\t', tup[i][0], '\t', tup[i][2],'\t',tup[i][1])
    price = int(tup[i][1])
    tprice += price
print(tprice)
Blue-eyed Beaver

Bagaimana membuat tagihan dalam python

tprice = 0
tup = [['apple','100','2'],['blackberry','100','23']]
f= open(filename,'w')
g= open('recpt.txt','r')
lines = g.readlines()
for line in lines:
    base = line.split()
    tup.append(base)
print('S.no','\t','Product','\t','Unit','\t','Price')
for i in range(len(tup)):
    if len(tup[i][0]) <= 7:
      print([i+1],'\t',tup[i][0],'\t','\t',tup[i][2],'\t',tup[i][1])
    else:
        print([i+1], '\t', tup[i][0], '\t', tup[i][2],'\t',tup[i][1])
    price = int(tup[i][1])
    tprice += price
print(tprice)
Blue-eyed Beaver

Bagaimana membuat tagihan dalam python

tprice = 0
tup = [['apple', '100', '2'], ['blackberry', '100', '23']]
myformat = "{:<10}{:<25}{:<5}{}"

f = open(filename, 'w')
g = open('recpt.txt', 'r')
lines = g.readlines()

for line in lines:
    base = line.split()
    tup.append(base)

print(myformat.format('S.no', 'Product', 'Unit', 'Price'))

for i in range(len(tup)):
    if len(tup[i][0]) <= 7:
        print(myformat.format(str([i + 1]), tup[i][0], tup[i][2], tup[i][1]))
    else:
        print(myformat.format(str([i + 1]), tup[i][0], tup[i][2], tup[i][1]))

    price = int(tup[i][1])
    tprice += price

print(tprice)
Blue-eyed Beaver

Jawaban yang mirip dengan “Bill Python”

Pertanyaan yang mirip dengan “Bill Python”

Lebih banyak jawaban terkait untuk “Bill Python” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya