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.

7th Jul 2022, 8:18 AM
Jose Luis Nara
Jose Luis Nara - avatar
5 Antworten
+ 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.
7th Jul 2022, 8:24 AM
Avinesh
Avinesh - avatar
+ 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.
7th Jul 2022, 10:55 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 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"
7th Jul 2022, 8:28 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 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.
7th Jul 2022, 8:47 AM
Jose Luis Nara
Jose Luis Nara - avatar
0
def printBill(text): print("======") print(text) can you halp me? where is a problem?
4th Aug 2023, 6:34 AM
Astay Kussidenova
Astay Kussidenova - avatar