Page 418 - ComputerScience_Class_11
P. 418
12.5.1 Free and Open-Source
Python is a free and open-source programming language. This means anyone can use it without paying any cost. One
of the biggest advantages of Python is that it is easy to access and can be used for many different purposes, which is
why it has become very popular. Python is developed under an OSI-approved open-source license, so it can be used,
shared and even sold as part of commercial software.
Note: To display the output we can use print() function.
12.5.2 Easy to Learn
Python is very easy to learn, especially for beginners. It is a high-level programming language that uses clear, simple,
English-like statements, which makes it easier for beginners to read and understand the code. Compared to languages
like Java and C, Python can do the same work using fewer lines of code, which saves time and effort. This simplicity is
one of the key benefits of using Python.
For example, to display a message in Python, only one line of code is required.
print("Hello World")
Note: In other languages like C or Java, this requires more lines of code.
12.5.3 Large Standard Library
Python has a very large collection of built-in libraries that users can easily access. These libraries help programmers
perform many tasks without writing code from scratch. Python’s standard library provides built-in functions for a wide
range of tasks, including file handling, mathematical operations, date and time processing and much more. Therefore,
users often do not need to install additional external libraries.
For example, to perform mathematical calculations, Python provides a built-in math library.
import math
print(math.sqrt(16))
The above code finds the square root of a number without writing your own logic.
Output:
4.0
Other example,
To display the date and time, Python provides a built-in datetime library.
import datetime
print(datetime.datetime.now())
The above code shows the current date and time using Python’s standard library.
Output:
2026-02-03 07:23:47.438880
12.5.4 Dynamically Typed
Python is a dynamically typed programming language. This means you do not need to declare the data type of a
variable before using it. Python automatically understands the type of a variable when the program runs. The variable
name acts as a reference to the value stored in memory and the data type is automatically decided at run-time based
on the assigned value. This makes coding easier and faster.
For example, to change the data type of a variable in Python, assign a value of a different type to it.
Program.py
File Edit Format Run Options Window Help
x = 10 # x is an integer
x = "Hello" # now x becomes a string
print(x)
416 Touchpad Computer Science (Ver. 3.0)-XI

