Page 433 - AI Ver 3.0 class 10_Flipbook
P. 433
• Maps: Maps are unordered data type used for mapping keys with its corresponding value.
✶ Dictionary: In Python, a dictionary is a data type that stores a collection of Key:Value pairs. Each key is
unique within the dictionary, and it maps to a corresponding value. Dictionary is represented by curly braces
{} with each pair separated by a comma (,). Dictionaries are mutable, meaning they can be modified after
their creation.
[1]: person = {'name': 'Yash', 'Department': 'Sales', 'city': 'Delhi'}
Operators
Operators are used to perform operations on variables and values. Let us study in detail about the commonly
used operators in Python.
Arithmetic Operators
Arithmetic operators are used to perform mathematical operations on variables and values. Arithmetic operators
used in Python are:
Name Symbol Purpose Example Output
Exponential ** First number raised to the 2**5 32
power second number. 3.5**3 42.875
Multiplication * Multiplies two values 5*4 20
Note, string * int repeats the 3.5*2 7.0
string that many times.
"Bye"*2 ByeBye
Division / Divides two numbers and 9/3 3.0
returns decimal value. 6.0/3 2.0
6/3.0 2.0
17/2 8.5
Floor division // Divides two numbers and 17//3 5
returns integer value.
-18//5 -4
23//6 3
Remainder % Returns the remainder of the 17%3 2
division.
3%5 3
Addition + Adds two numbers 10+4 14
Note: With strings it 2.5+4 6.5
concatenates two values. "Good"+"Morning" "GoodMorning"
Subtraction – Subtracts second values from 14-9 5
the first value. 5.5-2 3.5
Advance Python (Practical) 431

