Title
Unit 2:
Unit 3: Variables: an abstract storage location paired with an associated symbolic name x = 2 Data Types: Boolean, Lists, Dictionary, and Sequences
Assignment Operators: Used to assign value on right to left while performing the thing next to it Lists:an abstract data type that represents a finite number of ordered values, where the same value may occur more than once 2D Lists: collection of data cells, all of the same type, which can be given a single name Dictionaries: an abstract data type that defines an unordered collection of data as a set of key-value pairsv Class: a template definition of the method s and variable s in a particular kind of object Algorithms: Sequence: Selection: Iteration: Expressions: Comparison Operators: Booleans Expressions and Selection: Booleans Expressions and Iteration: Truth Tables: Characters: Strings: Length: Concatenation: Upper: Lower: Traversing Strings: Python If: Elif: Else conditionals: Python For: While loops with Range: with List: Combining loops with conditionals to Break: Continue: Procedural Abstraction: Python Def procedures: Parameters: Return Values:
## Variables: an abstract storage location paired with an associated symbolic name
x = 2
## Data Types: Boolean, Lists, Dictionary, and Sequences
x = 0
y = 10
if x > y:
print("x is greater than y")
else:
print("x is not greater than y")
fruits = ["apple", "grape", "strawberry"]
capital_city = {"Nepal": "Kathmandu", "Italy": "Rome", "England": "London"}
## Assignment Operators: Used to assign value on right to left while performing the thing next to it
a = 3
b = 5
a &= b
## Lists:an abstract data type that represents a finite number of ordered values, where the same value may occur more than once
fruits = ["apple", "grape", "strawberry"]
## 2D Lists: collection of data cells, all of the same type, which can be given a single name
N = 5
ar = [0]*N
print(ar)
## Dictionaries: an abstract data type that defines an unordered collection of data as a set of key-value pairs
capital_city = {"Nepal": "Kathmandu", "Italy": "Rome", "England": "London"}
## Class: a template definition of the methods and variables in a particular kind of object
class Person:
"This is a person class"
age = 16
def greet(self):
print('Hello')
## Algorithms: a procedure used for solving a problem or performing a computation
step1 = START ADD
step2 = get values of a & b
step3 = c ← a + b
step4 = display c
step5 = STOP
## Sequence: the first programming construct
cities = ['San Francisco', 'New York', 'Washington DC']
print('New York' in cities)
## Selection:
num = int(input('Enter any number: '))
if (num % 5 == 0):
print(f'Given number {num} is divisible by 5')
print('This statement belongs to if statement')
print('This statement does not belongs to if statement')
## Iteration:
## Expressions:
##Comparison Operators:
## Booleans Expressions and Selection:
## Booleans Expressions and Iteration:
## Truth Tables:
## Characters:
## Strings:
## Length:
## Concatenation:
## Upper:
## Lower: