I am making a terminal based game on python using the random module. In the following example, I am doing such, but the code return with the error TypeError: choice() takes 2 positional arguments but 282 were given
.
import random
academy = random.choice('Manchester City', 'Manchester United', 'Liverpool', 'Arsenal', 'Newcastle', 'Brighton', 'Tottenham', 'Aston Villa', 'West Ham', 'Chelsea', 'Crystal Palace', 'Brentford', 'Southampton', 'Bournemouth', 'Fulham', 'Wolves', 'Nottingham Forest', 'Leicester City', 'Everton', 'Leeds', 'Burnley', 'Sheffield United', 'Luton Town', 'Middlesbrough', 'Coventry City', 'Sunderland', 'Blackburn Rovers', 'Milwall', 'West Brom', 'Swansea', 'Watford', 'Preston', 'Norwich City', 'Bristol City', 'Hull City', 'Stoke City', 'Birmingham United', 'Cardiff City', 'Reading', 'Blackpool', 'Wigan Atheltic', 'Plymouth Argyle', 'Ipswitch Town', 'Sheffield Wednesday', 'Barnsley', 'Bolton Rovers', 'Peterborough', 'Derby County', 'Portsmouth', 'Wycombe', 'Charlton Atheltic', 'Lincoln City', 'Shrewsbury', 'Fleetwood', 'Exeter City', 'Burton', 'Cheltenham', 'Briston Rovers', 'Port Vale', 'Oxford United', 'Cambridge United', 'MK Dons', 'Morecambe', 'Accrington Stanley', 'Forest Green', 'Leyton Orient', 'Stevenage', 'Northampton Town', 'Stockport', 'Carlisle', 'Bradford City', 'Salford City', 'Mansfield Town', 'Barrow', 'Swindon Town', 'Grimsby Town', 'Tranmere', 'Crewe Alexandria', 'Sutton United', 'Newport County', 'Walsall', 'Gillingham', 'Doncaster', 'Harrogate Town', 'Colchester', 'AFC Wimbledon', 'Crawley Town', 'Hartlepool', 'Rochdale', 'Wrexham', 'Notts County', 'Barcelona', 'Real Madrid', 'Real Sociedad', 'Atletico Madrid', 'Villareal', 'Real Betis', 'Osasuna', 'Athletic Club de Bilbao', 'Mallorca', 'Girona', 'Rayo Vallecano', 'Sevilla', 'Celta Vigo', 'Cadiz', 'Getafe', 'Valencia', 'Almeria', 'Valladolid', 'Espanyol', 'Elche', 'Granada', 'Las Palmas', 'Levante', 'Alaves', 'Eibar', 'Albacete', 'Andorra', 'Oviedo', 'FC Cartagena', 'Tenrife', 'Burgos', 'Racing', 'Zaragoza', 'Leganes', 'Huesca', 'Mirandes', 'Sporting Gijon', 'Ponferradina', 'Malaga', 'Ibiza', 'Lugo', 'Napoli', 'Lazio', 'Inter Milan', 'AC Milan', 'Atalanta', 'Roma', 'Juventus', 'Fiorentina', 'Bologna', 'Torino', 'Monza', 'Udinese', 'Sassuolo', 'Empoli', 'Salernitana', 'Lecce', 'Verona', 'Speiza', 'Cremonese', 'Sampdoria', 'Forsinone', 'Genoa', 'Bari', 'Parma', 'Cagliari', 'Sudtirol', 'Reggina', 'Venezia', 'Palermo', 'Modena', 'Pisa', 'Ascoli', 'Como', 'Ternana', 'Cittadella', 'Brescia', 'Cosenza', 'Perugia', 'SPAL', 'Benevento', 'Bayern Munich', 'Borussia Dortmund', 'RB Leipzig', 'Union Berlin', 'SC Freiburg', 'Bayer Leverkusen', 'Eintracht Frankfurt', 'Wolfsburg', 'Mainz', 'Monchengladbach', 'Koln', 'Hoffenheim', 'VfL Bochum', 'Augsburg', 'VfB Stuttgart', 'Schalke', 'Hertha Berlin', 'Heidenheim', 'Darmstadt', 'Hamburger', 'Dusseldorf', 'St. Pauli', 'Paderborn', 'Karlsruher', '1. FCK', 'Hannover 96', 'Magdeburg', 'Furth', 'Hansa Rostock', 'Nurnberg', 'Eintracht Braunshweig', 'Arminia Biefield', 'Jahn Regensburg', 'Sanhausen', 'Paris Saint Germain', 'Lens', 'Marsielle', 'Rennes', 'LOSC', 'Monaco', 'Olympique Lyonnais', 'Clermont Foot', 'Nice', 'Lorient', 'Reims', 'Montpellier', 'Toulouse', 'Brest', 'Strasbourg', 'Nantes', 'Auxerre', 'Ajaccio', 'Troyes', 'Angers', 'Le Havre', 'Metz', 'Bordeaux', 'Bastia', 'Caen', 'Guingamp', 'Paris FC', 'St-Etienne', 'Sochaux', 'Grenoble Foot', 'Quevilly-Rouen', 'Amiens', 'Pau', 'Rodez', 'Stade Laval', 'Valencinnes', 'Annecy', 'Dijon', 'Nimes', 'Niort', 'Genk', 'Union Saint Gillose', 'Antwerp', 'Club Brugge', 'Gent', 'Strandard Liege', 'Westerlo', 'Cercle Brugge', 'Charleroi', 'Oud-Heverlee', 'Anderlecht', 'STVV', 'Mechelen', 'Eupen', 'Oostende', 'Zulte Waregem', 'RF Seraing', 'Feyenoord', 'PSV', 'Ajax', 'AZ Alkamaar', 'Twente', 'Sparta Rotterdam', 'Utrecht', 'Hereenveen', 'RKC Waalwijk', 'Vitesse', 'Go Ahead Eagles', 'NEC', 'Fortuna Sittard', 'FC Volendam', 'Excelsior', 'FC Emmen', 'Cambuur', 'Gronigen')
print(academy)
I have tried using file and importing the list from there, and using another list within this file itself, but it results in the following error:
File "main.py", line 4, in <module>
academy = random.choice(teams)
File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/random.py", line 378, in choice
return seq[self._randbelow(len(seq))]
Aucun commentaire:
Enregistrer un commentaire