Skip to main content

Featured post

Python Top Libraries You Need to Create ML Model

Creating a Model of Machine Learning in Python, you need two libraries. One is 'NUMPY' and the other one is 'PANDA'.


For this project, we are using Python Libraries to Create a Model.
What Are Key Libraries You Need I have explained in the below steps. You need Two.
NUMPY - It has the capabilities of CalculationsPANDA - It has the capabilities of Data processing. To Build a model of Machine learning you need the right kind of data. So, to use data for your project, the Data should be refined. Else, it will not give accurate results. Data AnalysisData Pre-processing How to Import Libraries in Pythonimportnumpy as np # linear algebra
importpandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

How to Check NUMPY/Pandas installed After '.' you need to give double underscore on both the sides of version. 
How Many Types of Data You Need You need two types of data. One is data to build a model and the other one is data you need to test the model. Data to build…

Python Syntax Rules Eliminate Errors Before you start debugging

In Python, if you know syntax rules, you can eliminate errors. The basic mistakes programmers do are missing semicolons, adding extra commas, and extra spaces. Python is case sensitive. So using the wrong identifier gives an error.
Indentation is unique to Python. You cannot find this kind of rule in any other programming languages

Python Syntax Cheat Sheet

These are the main areas you need to focus while writing a Python program. You need to learn rules. Else you need to waste a lot of time fixing the issues or errors.

  1. Indentation or Syntax Errors
  2. Exceptions
  3. Handling Exceptions
Python syntax guide

1. Indentation

If you do not follow 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 same indentation. Not only, the statement inside of them should have same indentation.
  • Understand these examples a good material on indentation for you.  

2. Exceptions 

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

  • Python has many built-in exceptions. One best example is ZeroDivisionError
  • More exceptions all list at 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')

In the above example, except shows error when you get an exception.

Python Syntax Guide


Related Posts

Comments

Most Viewed

Hyperledger Fabric Real Interview Questions Read Today

I am practicing Hyperledger. This is one of the top listed blockchains. This architecture follows R3 Corda specifications. Sharing the interview questions with you that I have prepared for my interview.

Though Ethereum leads in the real-time applications. The latest Hyperledger version is now ready for production applications. It has now become stable for production applications.
The Hyperledger now backed by IBM. But, it is still an open source. These interview questions help you to read quickly. The below set of interview questions help you like a tutorial on Hyperledger fabric. Hyperledger Fabric Interview Questions1). What are Nodes?
In Hyperledger the communication entities are called Nodes.

2). What are the three different types of Nodes?
- Client Node
- Peer Node
- Order Node
The Client node initiates transactions. The peer node commits the transaction. The order node guarantees the delivery.

3). What is Channel?
A channel in Hyperledger is the subnet of the main blockchain. You c…