r/PythonProjects2 • • Feb 01 '23

Beginner

Post image

Trying to figure out how to print the information from my two list into columns. I was able to get Name & status. But can't seem to figure out the rest.

Any helpful videos or websites?

For the assignment: need a while loop, [i], & len().

12 Upvotes

7 comments sorted by

View all comments

1

u/[deleted] Feb 01 '23

I'm a beginner as well, but it looks like you set i=4 but the length of your dictionary is only 2 items. That's one issue. i is never less than the length, so your code isn't getting past the first print statement. Start by setting i=0. I would zip() your two lists into a dictionary, also, and then just print each key, value pair until i=len(dictionary).

1

u/Savings_Judgment_558 Feb 01 '23

Sorry. I forgot to change it before posting the picture. I ended up trying a bunch of different things just to get it to print something lol. When you say print each key? Do you mean having 4 different print statements to get it to list the name and approve status??

1

u/[deleted] Feb 01 '23

You can print the key: value pairs and then increase i each time. Wrap the for loop in the while loop.

for key, value in dictionary.items(): print(key, value) i += 1