0

I am new to python and coding in general. I've been coding for about 2 months now and I'm working on my first simple game. In this game you control an army and can attack cities and upgrade your army with the money you get from conquering cities.

There are some places in the code where I want to selectively print elements to give the player options:

  • A list with the cities that can be attacked
  • A list with upgrades that can be bought

I only want to display the upgrades and cities that are still available (so print the upgrades that haven't been bought yet and the cities that haven't been conquered yet).

How can I print out the cities and upgrades that are available?

Thanks!

1 Answers1

0

I recommend you to use multidimensional lists, similar to this post: How to define two-dimensional array in python

You can define your lists with name as first, and availability as second argument. Then you could loop through your lists..

Away from your lists... For such a task, I usually recommend classes and object oriented programming.

Community
  • 1
  • 1
nox
  • 252
  • 5
  • 18