Introduction To Python: 6th School On LHC Physics
Introduction To Python: 6th School On LHC Physics
Adeel-ur-Rehman
IT Department
National Center for Physics
Introduction & Outline
In this tutorial:
Built-in Operators
Python Basics
Lists
Dictionaries
Functions
Classes
Inheritance
What is Python
Operators Description
^ Bitwise XOR
+, - Addition and
Subtraction
Operators (4/6)
Operators Description
*, /, % Multiplication, Division
and Remainder
+x, -x Positive, Negative
~x Bitwise NOT
** Exponentiation
Operators (5/6)
Operators (6/6)
Comparison with C++
class Student(SchoolMember):
t = Teacher('Mrs. Ibraheem', 40, 30000)
'''Represents a student.'''
def __init__(self, name, age, marks): s = Student(‘Ali', 21, 75)
SchoolMember.__init__(self, name, age) print # prints a blank line
self.marks = marks members = [t, s]
print '(Initialized Student: %s)' % for member in members:
self.name member.tell() # Works for instances of Student
def tell(self): as well as Teacher
SchoolMember.tell(self)
print 'Marks:"%d"' % self.marks
Modules