0

So I'm trying to make a program that has 3 variables a, b, and c (these stand for contestants on a made up talent show) I don't know how to make it randomly assign values but have it that together the 3 numbers add up to 100, I have look at question similar to this and have been confused and not been able to make them work for me.

  • *"I have look at question similar to this and have been confused and not been able to make them work for me"* You're kidding? All you have to do is copy/paste a function and call `constrained_sum_sample_pos(3, 100)`. – Aran-Fey May 22 '19 at 07:11
  • @Aran-Fey I did that but it was confusing and kept giving me an invalid syntax error also I would like to know what is happening so I can do it on my own and not need to ask for help. – Catz_4life May 22 '19 at 07:25
  • The answer has a nice graphical illustration that explains what it's doing, so I'm honestly not sure what else could be said to make it easier to understand. – Aran-Fey May 22 '19 at 07:42
  • @Aran-Fey yes I know but what I was saying is that when I was using that code and putting in the numbers 3, 100 I was getting an invalid syntax error and I'm not sure why. – Catz_4life May 22 '19 at 08:09
  • Yeah, I'm not sure why you're getting a syntax error either. – Aran-Fey May 22 '19 at 08:10
  • @Aran-Fey The invalid syntax is happening in the def constrained_sum_sampling_pos(3, 100) in the brackets here it's saying that 3 is an invalid syntax any idea why? – Catz_4life May 22 '19 at 09:14
  • Yes. You're mixing the syntax for a function *call* and a function *definition*. If that wasn't just a brainfart (which seems unlikely, considering that you've been stuck on that for 2 hours), please read a python tutorial. – Aran-Fey May 22 '19 at 09:27

0 Answers0