Use python and the text file to create a report that looks like this: Columbian
ID: 3836340 • Letter: U
Question
Use python and the text file to create a report that looks like this:
Columbian 6700.10 5012.45 6011.00 17723.55
Kona Coffee 8580.00 7201.25 8900.00 24681.25
Kopi Luwak 10225.25 9025.00 9505.00 28755.25
La Vazza 7901.25 4267.00 7056.50 19224.75
Peruvian Roast 9285.15 8276.10 8705.00 26266.25
42691.75 33781.80 40177.50
your input has to be like this in the file
Kona Coffee 8580.0 :7201.2 5 8900.0 Kopi Luwak 1022.5.2 5:9025 0:9505 .0 Columbian:6700. 1:5012.45:6011.0 Peruvian Roast 15 8276.1 8705 La Va :7901.25 4267.0:7056. 5 azzaExplanation / Answer
def func1():
file = open('Input.txt', 'r')
lines = file.readlines()
lines.sort();
for line in lines:
line.replace(":", " ")
line.replace(".0", ".00")
print line
if __name__ == '__main__':
func1()
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.