'i dont know where im wrong in this python code of conditional statements using if elif and else [closed]

this is what I'm trying to do but it keeps on saying something is wrong in line 15



Solution 1:[1]

There is an error in your code because you can not have an elif statement after an else statment.

Your code

if #something:
   #something
else #something:
   #something
elif #something:
   #something

Correct way:

if #something:
   #something
elif #something:
   #something
else #something:
   #something

Solution 2:[2]

the problem is nexted if and else should be intended other wise the first else goes with first else

avarage_grade =7
attendance=1
if (avarage_grade>=6):
    if(attendance>=0.8):
        print('student has passed')
    else: #here
        print("student has failed due to low attendance rate") # and here
elif(attendance>0.8):
    print("student has failed due to low avarage_grade")
else:
    print("student has failed due to low avarage_grade and low attendance rate")

also please post your code also... for future anyone to see

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Flow
Solution 2 Vaisakh K M