Skip to content
Advertisement

Print output for data list python

I am trying to print an output but I just can’t figure out method.

JavaScript

and I am trying to get an output like this: output

I don’t really understand array and I have tried a few methods but failed to output it as the image shows. If possible, I would need some explanation too because I want to learn rather than get the answer straight out. So, if you have a solution, I might ask for more information on it too. (you don’t have to explain it if you are not comfortable, but I just wish to learn more)

Thank you for attempting to help me. I am sorry if this is just a simple task but I am less than a beginner and trying to improve myself.

I am currently not outputting anything enter image description here

my print code is

JavaScript

Advertisement

Answer

  1. If you want to print multiple Book names and prices, etc you should put each one of them into a separate list in this case. (with append)
  2. If you want to print them out you can do like this:
JavaScript

… etc to the right format in wich purchase and sell are all lists. Don’t forget to add spaces. To check if the person actually input numbers you can use the method .isdigit()

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement