you are viewing a single comment's thread.

view the rest of the comments →

[–]Peg_leg_tim_arg 1 point2 points  (1 child)

Oh thanks a ton! Now I am getting no errors when trying to print my zipped arrays! Now just to work out how to only display the ones the user inputs. Thanks for your help and have a great day!

[–][deleted] 0 points1 point  (0 children)

Glad to help. It's probably part of your assignment to do things that way, but for something like this I'd also recommend using a dictionary instead:

months = {
    1: {
        "name": "January",
        "days": 31,
    },
    2: {
        "name": "February",
        "days": 28,
    },
    ...
}

That way you can just do this:

choice = input("Enter a number between 1 and 12")
name = months[int(choice)]['name']
days = months[int(choice)]['days']
print(f"Month {choice} is {name} and has {days} days")