+ 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)
12 Respuestas
+ 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)
+ 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)
+ 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))
+ 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
'''
+ 1
check this out;
password = input()
repeat = input()
def validate(text1, text2):
if text1 == text2:
print("Correct")
else:
print("Wrong")
validate(password, repeat)
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)
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
0
password = input()
repeat = input()
def validate(password, repeat):
if password == repeat:
print ("Correct")
if password != repeat:
print ("Wrong")
validate(password, repeat)
0
password = input()
repeat = input()
def validate(text1, text2):
if text1 == text2:
print("Correct")
else:
print("Wrong")
validate(password, repeat)
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)
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
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)