I am currently trying to write a simple program to calculate probabilities of possible combinations with dice of different sizes (e.g. : 6, 12, 4, 20). The problem i have is that it is supposed to be user friendly and work with ever int value the user puts. The problem i am having here is the following :
p = input('How many dice do you have ? :')
a = len(p)
x = 0
while x != a :
x += 1
(n + x) = input('What is the amount of faces of your ' + x + 'die ? :')
# here i want to create a variable named n1, n2, n3,... until the loop stops.
Can someone help me find a way around this without having to import dictionaries.
listordict, spend some time to learn the basic of python before writing anything that doesn't make sense. In the code above, the line(n + x) = input(...)is definitely wrong.len(p)is going to give you the length of the input string (for numbers 1-9, it will always return 1), you probably wantint(p), being aware that it's going to error if someone provides a non-integer input string.