mardi 21 novembre 2023

TypeError: super_shuffle() missing 1 required positional argument: 'color_list'

This is my code

import random
import copy

def super_shuffle(color_list):
    color_list_2 = copy.copy(color_list)
    random.shuffle(color_list_2)
    for old, new in zip(color_list, color_list_2):
        if old == new:
            return super_shuffle(color_list)
    
    return color_list_2

color1 = input("Pick a color:")
color2 = input("Pick a color:")
color3 = input("Pick a color:")
color4 = input("Pick a color:")
color5 = input("Pick a color:")
color6 = input("Pick a color:")
color_list = [color1, color2, color3, color4, color5, color6]

super_shuffle()

I am trying to get it to take your colors and shuffle them into a list, but then it comes up with this error

TypeError: super_shuffle() missing 1 required positional argument: 'color_list'

I am also trying to get it so I can edit the list after the list is already shuffled

I type in some colors but when they get shuffled, it is supposed to print them, but it doesn't. It just comes up with the error. I was expecting for it to print a list of my colors shuffled, but it just errored.




Aucun commentaire:

Enregistrer un commentaire