HELP! beginner python program

Hi, I am in my first semester of programming and I am sort of confused on how to do one of my assignments. My teacher is pretty picky on the way that our programs are written and will straight up give you a 0 if it is not correct. I know that for this assignment he mainly wants us to use the for and range functions but all the examples he gave us are dealing with only numbers. I am an example based learner and it is difficult for me to write a program simply off of definitions. If someone could help me with this I would be so grateful. And also, feel free to explain your reasoning for the way you choose to write it. I am not trying to cheat I am trying to learn!

THE PROBLEM:

Here the Code

SF = 26.97 #Salomon Fish
RS = 12.98 #Rideye Steak
SC = 4.96 #Sweet Corn
A = 5.92 #Asparagus
TP = SF+RS+SC+A #Total Amount
IP = [SF, RS, SC, A] #Item Price
ID = ["Salomon Fish", "Rideye Steak", "Sweet Corn", "Asparagus"] #Item Description
print("Item Description          Item Price")
print("====================================")
for i in range(len(IP)):
  print(f"{ID[i]}          {IP[i]}")

print(f"Your total purchase:{TP}")

Here the output
Capture
If this is not working you can tell me @emmak
Hope This Help

1 Like

Hey @AndrewAung11!

I am glad that you were to come up with a solution but it would be more helpful if instead you helped @emmak with how to arrive to the solution on their own.

I have edited your post to include the spoiler tags.

2 Likes

As you’ve not provided the input data type(list, tuple, dictionaries), I think I couldn’t help you with this…
Following links might help you to transverse through the list in python…
You can always ask here, if you face any problem

1 Like

Thanks. I am new so I don’t know many about this forum. :pray:

1 Like

Firstly, welcome to the forums.

While we are primarily here to help people with their Free Code Camp progress, we are open to people on other paths, too. Some of what you are asking is pretty trivial in the Free Code Camp context, so you might find that if you’re not getting the instruction and material you need in your current studies, the FCC curriculum will really help you get started. At a modest guess I’d say investing a 4-5 hours working through the curriculum here will really pay off. You can find the curriculum at https://www.freecodecamp.org/learn.

With your current questions, we don’t have enough context to know what you already know or don’t know, so it is impossible to guide you without just telling you the answer (which we won’t do).

It is pretty typical on here for people to share a codepen / repl.it / jsfiddle example of what they have tried so that anyone helping has more of an idea of what help is actually helpful.

Please provide some example of what you’ve tried and I’m sure you’ll get more help.

Happy coding :slight_smile:

1 Like