Skip to content

Instantly share code, notes, and snippets.

@NicolleLouis
Last active November 27, 2017 17:07
Show Gist options
  • Save NicolleLouis/23f7a67e85d128c1f21c67db13d6c39d to your computer and use it in GitHub Desktop.
Save NicolleLouis/23f7a67e85d128c1f21c67db13d6c39d to your computer and use it in GitHub Desktop.
create Item set
def generate_one_item(Max_weight, Max_value):
item = []
item.append(round(Max_weight * random.random()))
item.append(round(Max_value * random.random()))
return item
def generate_all_items(Number_of_item, Max_weight, Max_value):
list_item = []
for i in range(Number_of_item):
list_item.append(generate_one_item(Max_weight, Max_value))
return list_item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment