Featured post

Career Vs Your Attitude Do These Now

75% of the American workforce are actively looking for jobs at any given point in time, of which 69% of them are currently employed. 



Networking 
Tapping into your Network, Creating, and Maximizing your Personal Brand and Researching Companies in your Field of Interest will help you in finding jobs that suit your interest.


Trying to randomly find a job will get you nowhere. PREPARE, PLAN, and RESEARCH, and you will find a job that is meant for you.


If you have attended a get-together of friends or a social gathering off-late, chances are that you would have come across at least half a dozen people, talking about their jobs; how they are unhappy with it and looking for a change, or how difficult it seems to get one in the first place.
Job Search 

Searching for a job has become one of the most time-occupying tasks in recent times. Almost as difficult as getting one, a job search means researching, identifying, and applying for jobs and going through the functions of interviews, discus…

Python Syntax Errors Cheat Sheet

In Python, if you know syntax rules, you can eliminate errors. The mistakes programmers do are missing semicolons, adding extra commas, and extra spaces. Further Python is case sensitive. So using the wrong identifier gives an error.

Python Syntax Rules List


Python syntax cheat sheet

Indentation is unique to Python. You cannot find strict indentation in any other programming language. You need to focus on the three areas while writing a Python program. To avoid errors you need to learn indentation rules.

  • Indentation or Syntax Errors
  • Exceptions
  • Handling Exceptions

#1: Indentation

If you do not follow the proper order, you will get an error. The details of one block shroud follow in one vertical line.

The sub-block should be inside of that. In if loop, the IF, ELIF, and ELSE should have the same indentation. Not only, but the statement inside of them should also have the same indentation.

Best Examples

Understand these examples a good material on indentation for you.

#2: Exceptions


Python raises an exception, when it encounters an error. These are called system errors.

Python has many built-in exceptions. One best example is ZeroDivisionError

More exceptions all list in one place.

#3: Handling Exceptions


To handle exception you need two blocks which are Try and Except. Try Block is the block where you can give your code. Except is the Block where your exception message comes here.

Python Syntax Example:

try:
d = int(20)
f = str
g = d + f
except TypeError:
  print('This is TypeError Exception')
else :
  print('No exception happened')

Comments

Popular posts from this blog

How to Use Python Try and Except Logic Correctly

10 Top Unix Disk Space Quiz Questions

Hyperledger Fabric: 20 Real Interview Questions

How to Use Special Keys in UNIX