0

The code

Can you help me please, why is my code giving me error n1 = 3 n2 = 2 n3 = 4 n4 = 1 n5 = 5 if (n1 >= n2) and (n1 >= n3) and (n1 >= n4) and (n1 >= n5): largest = n1 elif (n2 >= n1) and (n2 >= n3) and (n2 >= n4) and (n2 >= n5): largest = n2 elif (n3 >= n1) and (n3 >= n2) and (n3 >= n4) and (n3 >= n5): largest = n3 elif (n4 >= n1) and (n4 >= n2) and (n4 >= n3) and (n4 >= n5): largest = n4 elif (n5 >= n1) and (n5 >= n2) and (n5 >= n3) and (n5 >= n4): largest = n5 print(largest)

17th Jun 2022, 6:54 PM
PJ Last King
2 Answers
+ 4
What error do you get? I don't see any indentation in your code. Why aren't you using a list and the max() function? People are more likely to help if you put your code in a script on sololearn playground: Go to Code section, click +, select the programming language, insert your code, save. Come back to this thread, click +, Insert Code, sort for My Code Bits, select your code.
17th Jun 2022, 7:04 PM
Lisa
Lisa - avatar
+ 1
SoloProg , pls do not give finished code in answers. Always prefer giving hints for the OP to find the solution. This is a learning app.
18th Jun 2022, 1:12 AM
Emerson Prado
Emerson Prado - avatar