Introduction to Python Programming, Lecture notes of Compilers

An introduction to the python programming language, covering its history, features, and applications. It delves into the basics of python, including data types, variables, expressions, and control structures. The course covers a wide range of topics, from fundamental programming concepts to more advanced features like object-oriented programming, data structures, file handling, and the use of external libraries for tasks like natural language processing and machine learning. The document aims to equip learners with a solid foundation in python, enabling them to develop practical problem-solving skills and build real-world applications. With its comprehensive coverage and hands-on exercises, this course is suitable for both beginners and those looking to expand their programming expertise.

Typology: Lecture notes

2023/2024

Uploaded on 08/26/2024

adam-mustafa-2
adam-mustafa-2 🇵🇸

3 documents

1 / 40

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
SELECTED
PROGRAMMING
LANGUAGE – PYTHON
Lecture 01
Dr. Mohammed Maree
Associate Professor in Information Technology
Faculty of Engineering & Information Technology
Arab American University, Palestine
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28

Partial preview of the text

Download Introduction to Python Programming and more Lecture notes Compilers in PDF only on Docsity!

SELECTED

PROGRAMMING

LANGUAGE – PYTHON

Lecture 01

Dr. Mohammed Maree Associate Professor in Information Technology Faculty of Engineering & Information Technology Arab American University, Palestine

About the Course

 (^) This course provides an introduction to the Python programming language, with applications to practical problem-solving involving data manipulation and analysis. The first part of the class focuses on teaching the basics of the Python language. Topics covered are data structures (lists, tuples, dictionaries, sets), functions, files, and object-oriented language elements. In the second part of the course students learn to apply advanced language features and methodologies in combination with third-party libraries for scientific computation to develop real-world applications.  (^) CLOs

Course Topics

 (^) Working with Functions  (^) Lambdas  (^) Object Oriented Programming in Python  (^) Creating Classes, class attributes, and class methods.  (^) Creating objects  (^) Python Data Structure (dictionary and list manipulation)  (^) Files (reading and store data in files, files pointer using seek)  (^) Debugging and Exception Handling  (^) Exception class hierarchy  (^) User-defined exceptions  (^) Spacy and NLTK: Sentence Tokenization, words tokenization, part of speech tagging, and finding entities in the text.

Course Topics

 (^) Regular Expression (searching using regex, password, email, urls, validation using regular expressions)  (^) Text Cleansing  (^) Intro. to Machine Learning in Python: Classification:  (^) Naive Bayes  (^) (Implementing a Simple Sentiment Analyzer)  (^) Graphical User Interface Planning  (^) Graphical frameworks  (^) Creating a Graphical User Interface

Introduction

 (^) https://pypl.github.io/PYPL.html

Introduction

 Who uses Python today:

 (^) Google makes extensive use of Python in its web search systems.  (^) The popular YouTube video sharing service is largely written in Python.  (^) The Dropbox storage service codes both its server and desktop client software primarily in Python.  (^) The Raspberry Pi single-board computer promotes Python as its educational language.  (^) Maya, a powerful integrated 3D modeling and animation system, provides a Python scripting API.  (^) Netflix and Yelp have both documented the role of Python in their software infrastructures.  (^) Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm, and IBM use Python for hardware testing.

Introduction

 (^) Python Virtual Machine (PVM)  (^) Once your program has been compiled to byte code (or the byte code has been loaded from existing .pyc files), it is shipped off for execution to something generally known as the Python Virtual Machine.

Intro to Python:

 (^) Arithmetic Operators:  (^) Addition +  (^) Subtraction –  (^) Multiplication *  (^) Division /  (^) Floor Division //  (^) Exponentiation **  (^) Reminder (Modulo) % y = a * x ** 2 + b * x + c y = ( a * ( x ** 2) ) + ( b * x) + c

Intro to Python:

 (^) Print Function: Single and Double-Quoted Strings  (^) print(' Welcome\nto\n\nPython! ‘) Welcome to Python!

Intro to Python:

 (^) Print Function: Single and Double-Quoted Strings  (^) print( 'this is a longer string, so we
split it over two lines’) this is a longer string, so we split it over two lines

Intro to Python:

 (^) TRIPLE-QUOTED STRINGS  (^) print('Display 'hi' in quotes’) Display 'hi' in quotes  (^) print("""Display "hi" and ' bye' in quotes""") Display "hi" and ' bye' in quotes

Intro to Python:

 (^) TRIPLE-QUOTED STRINGS  (^) triple_quoted_string = """This is a triplequoted

... : string that spans two lines\nThis is a triplequoted ... : string that spans two lines"""  (^) print(triple_quoted_string) This is a triplequoted ... : string that spans two lines This is a triplequoted ... : string that spans two lines

Intro to Python:

 (^) Getting Input from the User  (^) name = input("Please enter your name:\n")  (^) age = int(input("Please enter your age:\n"))  (^) print(name, " " , age) Please enter your name: Mohammed Maree Please enter your age: 39 Mohammed Maree 39

20

Intro to Python:

 (^) Variables and Expressions:  (^) A variable is used to bind a name to an object. A variable name refers to a particular object.  (^) A variable name , such as x , is an identifier. Each identifier may consist of letters , digits and underscores (_) but may not begin with a digit.  (^) Python is case sensitive , so number and Number are different identifiers because one begins with a lowercase letter and the other begins with an uppercase letter.  (^) An expression is a line of code that can be reduced to a value number = 5 print ( type (number)) neg= number-* neg/= print ( type (neg))