0
Problem with function arguments
I can't pass the python function arguments activity, this is the code I'm using: password = input() repeat = input() def validate(text1, text2): if text1 == text2: print("Correct") else: print("Wrong") validate(password, repeat) I keep getting an error, can somebody help me?? I'm supposed to get "Wrong" as a result. Thanks.
5 odpowiedzi
+ 3
password = input()
repeat = input()
def validate(text1, text2):
if text1 == text2:
print("Correct")
else:
print("Wrong")
validate(password, repeat)
Probably indentation problem.
If the password and repeat are different values then you would get Wrong.
+ 3
Jose Luis Nara
Python Core 19.1
There is this written in a yellow box
Python uses indentation (white space at the beginning of a line) to delimit blocks of code. Depending on program's logic, indentation can be mandatory. As you can see, the statements in the if should be indented.
+ 2
Jose Luis Nara
Your first problem is indentation, and your 2nd problem is the really strange bit on the end of your function.
Maybe that was supposed to call the function, but has not been separated.
May I suggest you attach your playground attempt so we can see a working model with a description of the task.
I suspect this is the exercise which looks for a word in a sentence using a function to ascertain if 'Found" or "Not Found"
+ 2
a Wolf Rik Wittkopp that was the exact problem, thanks .
Where can I learn more about indentation in python? I don't remember ever see it in the python course.
0
def printBill(text):
print("======")
print(text)
can you halp me? where is a problem?