Course Content
What is Python?
Introduction of Python and Its setup
0/2
Control Statement
Control statements are used to control the flow of execution depending upon the specified condition/logic.
0/4
File Handling
File handling is an important component of any application. Python has multiple functions for creating, reading, updating, and deleting files.
0/2
Examples
Following are the examples of python scripts to try hands-on, you are ready to start your python journey.
0/7
Python
About Lesson

Number

The numeric data type is used to store numeric values i.e [0-9]. Python has three numeric data types:

1. Integers

Ex: a = 20

2. Floating Point numbers

Ex: a = 20.0

3. Complex numbers

Ex: a = complex(20,5) # 20+5j

String

A string is a sequence of characters. In python, we can create a string using a single ( ‘ ‘ ) or double quotes (” “). Both are the same in python

str = 'computer engineering'
print('str- ', str) # print string
print('str[0]-', str[0]) # print 1st char
print('str[1:3]-', str[1:3]) # print string from position 1 to 3
print('str[3:]-', str[3:]) # print string starting from 3rd char
print('str*2-' , str*2) # print string two times
print('str + yes-', str+'yes') # concatenated string

Boolean

It is used to produce values either true or false.

str = "comp eng"
b = str.isupper()
print(b)

Tuple

A tuple is an immutable Python Object. Immutable python objects mean we cannot alter the contents of a tuple once it is assigned. It is represented by () parenthesis.

tup = (66,99)
Tup[0] = 3 #error will be displayed
print(tup[0])
print(tup[1])

Set

It is an unordered collection of unique and immutable items. It is represented by {} curly braces.

set1 = {11, 22, 33, 22}
print(set1)

Dictionary

It is an unordered collection of items and each item consists of a key and a value.

dict = {'subject' : 'comp eng", 'class' : '11'}
print(dict)
print( "Subject :", dict["subject"])
print("class :", dict.get('class'))