I am trying to make a simple game for class but I am getting hung up on one of the parts. There are two dice that roll and then you can input either the full sum or multiple numbers that equal the sum (ex. dice = 10 you could pick 10 or 3,2,5). From there each of the numbers picked will be removed from a list.

It should run a little like this,

Dice = 9
Numbers picked = 3, 5, 1
(list after the numbers were removed) [2,4,6,7,8,9]

How would I go about doing this?

Split on the comma and test for length. If the length is one, then a total was entered, otherwise it is a series of numbers. One alternative is to use easygui, with one box for the total and a second entry box for individual numbers, so which ever box has an entry (length) is the function you choose.

>>> dice_num = 9
>>> available = set(range(1, 1+dice_num))
>>> remove = raw_input('Give comma separated values: ')
Give comma separated values: 3,5,1
>>> left_over = available - set(int(r) for r in  remove.strip().split(','))
>>> left_over
set([2, 4, 6, 7, 8, 9])
>>> remove = raw_input('Give comma separated values: ')
Give comma separated values: 4
>>> left_over = available - set(int(r) for r in  remove.strip().split(','))
>>> left_over
set([1, 2, 3, 5, 6, 7, 8, 9])
>>>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.