Python question function argument | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Python question function argument

You are given a program with two inputs: one as password and the second one as password repeat. Complete and call the given function to output "Correct" if password and repeat are equal, and output "Wrong", if they are not. Sample Input nfs1598 nfs1598 Sample Output Correct My code: password = input() repeat = input() def validate(text1, text2): password == repeat print ("Correct") password != repeat print ("Wrong") validate(text1, text2) print (validate)

3rd Dec 2020, 4:02 AM
Yazan
12 Answers
+ 8
Hii Yazan You are having a issue in "if" condition only! Why don't you learn or revise It again? It will help you better.. - https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/python_conditions.asp Though I believe this will help! password = input() repeat = input() def validate(text1, text2): If password == repeat print ("Correct") If password != repeat print ("Wrong") validate(text1, text2) print (validate)
3rd Dec 2020, 4:49 AM
Piyush
Piyush - avatar
+ 6
password = input() repeat = input() def validate(text1, text2): #your code goes here if password == repeat: print("Correct") elif password != repeat: print ("Wrong") validate(password, repeat)
17th May 2022, 7:28 AM
Najwan Najmussabah
+ 2
WORKS FINE! password = input() repeat = input() def validate(text1, text2): #your code goes here return "Correct" if text1 == text2 else "Wrong" print(validate(password, repeat))
12th Jul 2021, 10:00 AM
Constantine Tvalashvili
Constantine Tvalashvili - avatar
+ 1
Yazan you forget to indent if conditions..and also you don't need two if blocks you can use else instead also you didn't Call the function . password=input() repeat=input() def validate(text1, text2) : if password == repeat : print("Correct") else: print("Wrong") validate(text1, text2) ''' 1) sample input : nfs1598 nfs1598 output : Correct 2) sample input : nfs1598 nfs2020 output : Wrong '''
3rd Dec 2020, 6:05 AM
Ratnapal Shende
Ratnapal Shende - avatar
+ 1
check this out; password = input() repeat = input() def validate(text1, text2): if text1 == text2: print("Correct") else: print("Wrong") validate(password, repeat)
27th Jan 2023, 6:42 AM
Himasha Nethmini
Himasha Nethmini - avatar
0
#Here is the solution, works perfectly : password=input() repeat=input() def validate(text1, text2) : if password == repeat : print("Correct") else: print("Wrong") validate(password, repeat)
3rd Apr 2021, 2:01 PM
Allan 🔥STORMER🔥🔥🔥🔥
Allan 🔥STORMER🔥🔥🔥🔥 - avatar
0
password = input() repeat = input() def validate(password, repeat): if password == repeat: print ("Correct") if password != repeat: print ("Wrong") validate(password, repeat) pretty sure this works
22nd Oct 2021, 10:39 PM
Jay Prabhu Vadolkar
Jay Prabhu Vadolkar - avatar
0
password = input() repeat = input() def validate(password, repeat): if password == repeat: print ("Correct") if password != repeat: print ("Wrong") validate(password, repeat)
22nd Oct 2021, 10:39 PM
Jay Prabhu Vadolkar
Jay Prabhu Vadolkar - avatar
0
password = input() repeat = input() def validate(text1, text2): if text1 == text2: print("Correct") else: print("Wrong") validate(password, repeat)
10th Jan 2022, 2:16 PM
Josh
Josh - avatar
0
password = input() repeat = input() def validate(text1, text2): #your code goes here if password == repeat: print("Correct") elif password != repeat: print ("Wrong") validate(password, repeat)
27th Jan 2022, 1:01 AM
Arbab Ansari
Arbab Ansari - avatar
0
so this is it, password= input() repeat = input() def validate(text1, text2): if (password == repeat): print("Correct") elif (password != repeat): print("Wrong") validate(password,repeat) Good luck everyone
13th Jan 2023, 8:19 AM
Odoi Yona
Odoi Yona - avatar
0
password = input() repeat = input() def validate(text1, text2): #your code goes here if text1 == text2 : print("Correct") else: print("Wrong") text1 = password text2 = repeat validate(text1, text2)
16th Apr 2023, 1:24 PM
AMINE MOUTAOUAKKIL