I am unsure as to why the following doesn't work:
def main():
userInputs()
print(firstColour)
def userInputs():
validColours = ['red', 'green', 'blue', 'yellow', 'magenta','cyan']
while True:
firstColour = input('Enter the 1st colour: ')
secondColour = input('Enter the 2nd colour: ')
thirdColour = input('Enter the 3rd colour: ')
fourthColour = input('Enter the 4th colour: ')
if firstColour in validColours:
if secondColour in validColours:
if thirdColour in validColours:
if fourthColour in validColours:
break
else:
print('Invalid colours.Enter the colours again between red, green, blue, yellow, magenta, cyan')
return firstColour, secondColour, thirdColour, fourthColour
I thought that if i called the main function, It would print whatever I entered as the firstColour?
returnstatement. Right now you've got it inside thewhilewhen you mean to have it after thewhiletermiantes.