0
Error on python
need help with the error I am getting from this code https://code.sololearn.com/c76YgIfcAe02/?ref=app
7 Réponses
+ 2
Finnaly got the code working! It now evenly distributes the players between each team! Thank you all so much for your help! Here is the code:
https://code.sololearn.com/cN9BjQgzIGDa/?ref=app
+ 1
https://code.sololearn.com/cN9BjQgzIGDa/?ref=app
This is a better version of the program, and it is now working with no errors. However, one thing I don't understand is the fact that each team is supposed to have an even number of players, yet they don't. Also, this is supposed to randomly select a team for the given amount of players.
Thank you both so much for your help!
+ 1
PS. you might have to enter a large number and several times in order to see it malfunction
+ 1
This should give some ideas on how to solve the random problem
https://stackoverflow.com/questions/976882/shuffling-a-list-of-objects
+ 1
It still doesn't put an even number of players on each team
0
Close paren on line 6 and you can't use keywords to name a function or anything else (yes I meant to do that).
0
https://code.sololearn.com/c5jPem0kqyG9/?ref=app
I try to eliminate the error, but i don't know what do you want to do in this program.
some changes:
(1)declare a function before calling it
(2)use global keyword if you wany to change the global variable in a function
(3)use str(c) instead of c
(4)I don't know what do you mean "one" and "two"