Click here to Skip to main content
15,902,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Python
if beg_bal + trans_amt > 0:
    
    print('Your account balance is: ',(round((beg_bal + trans_amt), 3)))
    
    elif beg_bal + trans_amt == 0:
        
            print('Your account balance is Zero!')
         
                else beg_bal + trans_amt <0:
             
                    print('Account is Over Drawn!!, ', (round((beg_bal + trans_amt), 3)))

I keep getting syntax error

What I have tried:

I have tried re-typing the code to no avail. I am completely lost and need some help!
Posted
Updated 8-Feb-21 22:34pm
v2
Comments
Patrice T 8-Feb-21 21:16pm    
And you plan to tell us the error message ?
Use Improve question to update your question.

I don't know Python, however I easily found a site that accepts Python source and compiles&executes it, so I learned a lot in a matter of minutes. Thank you for that.

In the 6 lines of code shown you have several mistakes, including:

1. your variables don't have a value
2. conditional lines require indentation (maybe that was OK when you pasted your code and CodeProject swallowed them, maybe not)
3. your else should be elif (or just else: without an expression)

Would you consider reading a book (or e-book) on Python and learn something? if you don't master the basics you won't get nowhere soon.

:)
 
Share this answer
 
v3
Indentation in python is important, and it often confuses beginners.
Start by looking at this: Hello I have a syntax error is the program can someone help me to solve it thank[^] and read my reply - it's fairly long, but he had the same problem you do, and the solution is the same!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900