TypeError: create_purple () nimmt 0 Positionsargumente an, aber 2 wurden gegeben

ch bin brandneu in der Python-Programmierung und versuche, dieses Programm zum Laufen zu bringe

Ich habe dieses Programm nur mit den Anweisungen "if" und "else" zum Laufen gebracht. Ich wollte jedoch dasselbe Programm mit der folgenden Methode erstellen. Wenn ich das Programm ausführe, erhalte ich immer wieder die Fehlermeldung "TypeError: create_purple () verwendet 0 Positionsargumente, aber 2 wurden angegeben", und ich kann nicht herausfinden, warum.

Hier ist mein Code:

#*******************************************************************************************
#
# This program will take any two primary colors and create a secondary color.
#
# Primary colors are:
# Blue, Red, Yellow
# 
# Secondary colors are:
# Green, Orange, Purple
#

#Clear the screen
import os
os.system('cls') 

RED = "red"
BLUE = "blue"
YELLOW = "yellow"

def main():
    print ('\n')
    # Tell the user the objective of the program.
    print ('*****************************************************************************')
    print ('*****************************************************************************')
    print ('\n')
    print ('The objective of this program is to create a secondary color from two primary')
    print ('colors. When asked, choose two primary colors (Red, Blue, or Yellow) to create')
    print ('a secondary color ')

    # Choose your colors
    color1 = input('Enter your first primary color: ')
    color2 = input('Enter your second primary color: ')

    # Determine the secondary color
    if color1 == RED and color2 == BLUE:
    create_purple(color1,color2)


def create_purple():

    # Determine the color is purple
    if color1 == RED and color2 == BLUE:
        print ('\n')
        print ('You have made the color.... Purple ')
    else:
        if color1 == BLUE and color2 == RED:
            print ('\n')
            print ('You have made the color.... Purple ')

# Call the main function
main()

Antworten auf die Frage(1)

Ihre Antwort auf die Frage