Question

Programming Activity 1(Python) Utilise a count-based iteration structure that will accepts the data listed below and...

Programming Activity 1(Python) Utilise a count-based iteration structure that will accepts the data listed below and produce the total purchase amount. Your final report should be similar to the one show below.

Input Data:

Item Description Item Price

Salomon Fish $ 26.97

Ribeye Steak $ 12.98

Sweet Corn $ 4.96

Asparagus $5.92

Output:

Item Description Item Price

=================================

Salomon Fish. $26.97

Ribeye Steak $ 12.98

Sweet Corn $ 4.96

Asparagus $ 5.92

Your total purchase: $ xx.xx

I already posted this question, and I really do not understand the expert's answer. I am a very beginner at programming, and I need a very basic python code. We just learned "while" and "for" loop. And selection structure.

Homework Answers

Answer #1

Code and output

Code for copying

s_f = float(input("Salomon Fish $ "))
r_s =float(input("Ribeye Steak $ "))
s_c =float(input('Sweet Corn $ '))
a=float(input("Asparagus $ "))
print("Item description Item price")
print('===================================')
print("Salomon Fish $ {}".format(s_f))
print("Ribeye Steak $ {}".format(r_s))
print("Sweet Corn $ {}".format(s_c))
print("Asparagus $ {}".format(a))
print("Yout total purchase: $ {:.2f}".format(s_f+r_s+s_c+a))

Code snippet

s_f = float(input("Salomon Fish $ "))
r_s =float(input("Ribeye Steak $ "))
s_c =float(input('Sweet Corn $ '))
a=float(input("Asparagus $ "))
print("Item description Item price")
print('===================================')
print("Salomon Fish $ {}".format(s_f))
print("Ribeye Steak $ {}".format(r_s))
print("Sweet Corn $ {}".format(s_c))
print("Asparagus $ {}".format(a))
print("Yout total purchase: $ {:.2f}".format(s_f+r_s+s_c+a))
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT