Simple Print Code using Python
Here is a simple code to show you how Python is simple and easy to learn for a person who has no programming knowledge. The user can execute Python syntax by writing directly in the Command Line.
Basic Python Syntax
Python indentation shows that when a block of code begins and ends. In Python indentation is very important its not just a simple spacing for the readability of code it’s a predefined set of rules for spacing of code If you write a code without indentation it will generate an error. Other programming languages use brackets or keywords instead. Let’s use an example to understand indentation.
As we can see in the above example print is indented four spaces.
Comments in Python:
Comments are very useful lines to explain any code line to others. It is a good practice for a developer to add comments to the code. There the two types of comments single-line comments and multiple-line comments.
Single-line comments can be used by writing # as you can see in the following example:
Multiple-line comments can be written by using “””” ””” triple quotes as you can see in the following example:
Comment lines will be ignored by the Python interpreter.
The reserve has a specific use you can not use the theme as a variable name, object name, or any constant or identifier name. Every language has its own reserved words also known as keywords. The following list shows Python reserved.
Data Types in Python
In every programming language, there will be nothing done without data and every piece of data has its type there are different types of data. In Python, we have some built-in data types for different types of data as:
|Built-in Data Types
|Types of Data
|int, float, complex
|list, tuple, range
|Bytes, bytearray, memoryview
We can check the type of data by using the type () function:
Print the data type of the variable x:
Escape sequences are control characters used to move the cursor and print such as ‘, “, \, etc.
|Backslash and Newline ignored
Author: TCF Editorial
Copyright The Cloudflare.