CBSE

Data Types in Python

Data Type: It specifies the type of data and associated operations of handling it. Different set of operations are applicable on different types of data. Example: We can add, subtract, multiply, divide two numbers. But we cant subtract, multiply, divide two strings ie textual data. Data Types in Python: Following data types are supported in …

Data Types in Python Read More »

Modules in Python

Module: It is a file containing python definitions and statements. It may contain functions, classes, and variables. Grouping related code into a module makes the code easier to understand and use. How to import a module: We can import a module in python asimport modulename >>> import math >>> import random >>> import statistics We …

Modules in Python Read More »

Types of Errors in Python

Error/Bug: Error is a mistake/bug in the program which makes the behavior of the program abnormal. It prevents a program from compiling and running correctly. So, the errors must be removed from the program for the successful execution of the program. Programming errors are also known as the bugs. These errors are detected either during …

Types of Errors in Python Read More »

Functions of Strings in Python

Strings: Any combination of characters or text written in single, double, or triple quotes are treated as strings. Internally strings are stored in single quotes. Example: #string of lowercase and uppercase alphabetsstring1=”Gargs Academy” #string of alphanumeric characters ie alphabets and digits string2=”Phone no 9467863365″ #empty Stringstring3=”” Creating Strings by directly assigning string literals: We can …

Functions of Strings in Python Read More »

Comments in Python

Comments: These are the statements that are ignored by the python interpreter and not executed at all. Why Comments are used:1) To explain the program2) To make the program more understandable3) To prevent the statements from execution for testing purpose. Types of Comments in Python: 1) Single Line Comment2) Multi LIne Comment Single Line Comment: …

Comments in Python Read More »

Variables in Python

Variable : It is a symbolic name that is a reference or pointer to an object. Once an object is assigned to a variable, you can refer to the object by that name. Example: a=5b=10.78c=2 + 7jd=”Gargs Academy”e=Truef=Nonea,b,c,d,e,f are variables of different types. We can assign any type of value to a variable in python. …

Variables in Python Read More »

Functions of tuples in Python

Tuples: Tuples are used to store multiple items (may be of same type elements ie homogeneous data types or different types elements ie heterogeneous data types) in a single variable. It is a comma separated list of values enclosed in paranthesis ( ). Example: tuple1=(2,3,4,5) #tuple of homogeneous elements tuple2=(“gargs”, 100, 24.56 ) #tuple of …

Functions of tuples in Python Read More »

Functions of lists in Python

Lists: Lists are used to store multiple items (may be of same type elements ie homogeneous data types or different types elements ie heterogeneous data types) in a single variable. It is a comma separated list of values enclosed in square brackets [ ]. Example: list1=[2,3,4,5] #list of homogeneous elements list2=[“gargs”, 100, 24.56 ] #list …

Functions of lists in Python Read More »

Introduction to Python

Python Features of Python: Interactive mode is where you type commands and they are immediately executed. Example: >>> print(“Welecome to Python @Gargs Academy”) Welecome to Python @Gargs Academy Script mode is where you put a group of commands into a file (a script), save it with any name (.py extension) and then Run Program to run …

Introduction to Python Read More »

error: You can only copy the programs code and output from this website. You are not allowed to copy anything else.