Home > OS >  Using Python to create a simulation
Using Python to create a simulation

Time:12-27

I have these five lists:

list_1 = ['1','2','3','4','5']
list_2 = ['2','4','6','8','10']
list_3 = ['3','6','9','12','18']
list_4 = ['1','3','5','7','9']
list_5 = ['2','3','5','7','8']

What I am trying to do is make a simulation that will have drop down menus, where each menu 1 through 5 is correlated with each list 1 through 5 respectively. But, the trick is that if there is a string value that is already choosen and present in one of the menus, the other menus that has the same string value will no longer have that as an option.

For example, '3' is present in list_1, list_3, list_4, and list_5.If I choose '3' for menu 4, then the option of '3' will no longer be available for list_1, list_3, and list_5.

What I have done: I imported the itertools library, so I could find all possible combinations of the lists, respective to each menu.

import itertools
combos = list(itertools.product(list_1, list_2, list_3, list_4, list_5))

I know this might not be useful for the actual code later, but I thought it would be a good reference point. Next, I started looking into libraries that might be useful for this approach, I found tkinter was a good library.

import tkinter as tk

# Creating the main window
window = tk.Tk()

After this point, I'm sort of confused. How should I go about trying to code? I'm using the following documentation: List1

List3

List4

List5

  • Related