Computer Science TTR
Computer Science TTR
Exception Handling
Syntax
raise Exception(“Text”)
assert(10>100), “Not possible”
try:
a = int(“abc”)
print(10/0)
except ZeroDivisionError:
print(“Division by zero not possible”)
except:
print(“Some error”)
else:
print(“No exception has been raised if this
prints”)
finally:
print(“Always prints regardless of exception or
not”)
Stack
Class 11 Python
Python Keywords
Order of Precedence
Argument (Functions)
An argument is a value passed to the function during the function call.
Parameter (Functions)
Parameter is defined in the function header.
Scope of a Variable
The part of the program where a variable is accessible can be defined as
the scope of that variable.
1. Global Variable:
A variable that is defined outside any function or any block is
known as a global variable.
2. Local Variable:
A variable that is defined inside any function or a block is known as
a local variable.
String Functions
List Functions
Tuple Functions
Dictionary Functions