Python Fundamentals
April 17, 2025
1
What is Programming and Python?
What is Programming
- Programming is a way for us to tell computers what to do. The computer is a very dumb machine, and it only does what we tell it to do. Hence we learn to program and tell computers to do what we are very slow at - computation. If I ask you to calculate 5+6, you will immediately say 11. How about 23453453 X 56456?
- You will start searching for a calculator or jump to a new tab to calculate the same. This code series will help you learn python from beginning to end. We will start from 0, and by the time we end this course, I promise you will be ready Python developer!
What is Python?
- Python is a dynamically typed, general-purpose programming language that supports an object-oriented programming approach as well as a functional programming approach.
- Python is an interpreted and high-level programming language.
- It was created by Guido Van Rossum in 1989.
Features of Python
- Python is simple and easy to understand.
- It is Interpreted and platform-independent, which makes debugging very easy.
- Python is an open-source programming language.
- Python provides very big library support. Some of the popular libraries include NumPy, Tensorflow, Selenium, OpenCV, etc.
- It is possible to integrate other programming languages within python.
What is Python used for
- Python is used in Data Visualization to create plots and graphical representations.
- Python helps in Data Analytics to analyze and understand raw data for insights and trends.
- It is used in AI and Machine Learning to simulate human behavior and to learn from past data without hard coding.
- It is used to create web applications.
- It can be used to handle databases.
- It is used in business and accounting to perform complex mathematical operations along with quantitative and qualitative analysis.
Comments, Escape sequence & Print in Python
Today we will talk about Comments, Escape Sequences, and a little more about the Python print statement. We will also throw some light on Escape Sequences.
Python Comments
A comment is a part of the coding file that the programmer does not want to execute, rather the programmer uses it to either explain a block of code or to avoid the execution of a specific part of code while testing.
Single-Line Comments:
To write a comment, just add a ‘#’ at the start of the line.
Example 1 :
#This is a 'Single-Line Comment'
print("This is a print statement.")
Output :
This is a print statement.
Multi-Line Comments :
To write multi-line comments, you can use ‘#’ at each line, or you can use the multiline string.
#It will execute a block of code if a specified condition is true.
#If the condition is false then it will execute another block of code.
p = 7
if (p > 5):
print("p is greater than 5.")
else:
print("p is not greater than 5.")
Output :
p is greater than 5.
Escape Sequence Characters:
- To insert characters that cannot be directly used in a string, we use an escape sequence character.
- An escape sequence character is a backslash \ followed by the character you want to insert.
- An example of a character that cannot be directly used in a string is a double quote inside a string that is surrounded by double quotes:
More on the Print statement:
The syntax of a print statement looks something like this:
The syntax of a print statement looks something like this:The syntax of a print statement looks something like this:
print(object(s), sep=separator, end=end, file=file, flush=flush)
Other Parameters of Print Statement:
- Object (s): Any object, and as many as you like. Will be converted to a string before printed
- sep='separator': Specify how to separate the objects if there is more than one. The default is ' '
- end='end': Specify what to print at the end. Default is '\n' (line feed)
- file: An object with a write method. The default is sys. stdout
