Introduction to Python

Slides:



Advertisements
Similar presentations
Making Choices in C if/else statement logical operators break and continue statements switch statement the conditional operator.
Advertisements

CS 100: Roadmap to Computing Fall 2014 Lecture 0.
ECS 15 if and random. Topic  Testing user input using if statements  Truth and falsehood in Python  Getting random numbers.
Top-Down Design CSC 161: The Art of Programming Prof. Henry Kautz 9/16/2009.
July 13 th.  If/ Else if / Else  Variable Scope  Nested if/else's  Switch statements  Conditional Operator.
Identifiers and Assignment Statements. Data structures In any programming language you need to refer to data The simplest way is with the actual data.
Python Control of Flow.
CIS Computer Programming Logic
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Introduction to Python Basics of the Language. Install Python Find the most recent distribution for your computer at:
Computer Science 111 Fundamentals of Programming I Overview of Programming.
Computer Science 101 Introduction to Programming.
I Power Int 2 Computing Software Development High Level Language Constructs.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
Built-in Data Structures in Python An Introduction.
C463 / B551 Artificial Intelligence Dana Vrajitoru Python.
Xin Liu Feb 4, * Use midterm questions for previous 231/217 midterms for practices * ams
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 8 Lists and Tuples.
CS105 Computer Programming PYTHON (based on CS 11 Python track: lecture 1, CALTECH)
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
Midterm Exam Topics (Prof. Chang's section) CMSC 201.
LISTS and TUPLES. Topics Sequences Introduction to Lists List Slicing Finding Items in Lists with the in Operator List Methods and Useful Built-in Functions.
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
Python Basics  Values, Types, Variables, Expressions  Assignments  I/O  Control Structures.
Lists in Python List methods and functions. List methods MethodSemantics list.append(x)Adds x to the right end of list, changes original list list.sort()Sorts.
PYTHON PROGRAMMING. WHAT IS PYTHON?  Python is a high-level language.  Interpreted  Object oriented (use of classes and objects)  Standard library.
Introduction to python programming
Web Database Programming Using PHP
Containers and Lists CIS 40 – Introduction to Programming in Python
Web Database Programming Using PHP
Logic Gates.
Lecture 10 Data Collections
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Hector Cen Fall 2017
Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during.
JavaScript: Functions.
While Loops in Python.
Lab 2 : Structures Muhammad Zaigham Abbas Shah DIGITAL INSTRUMENTATION SYSTEMS.
Chapter 5 Structures.
Advanced Programming Behnam Hatami Fall 2017.
Arrays, For loop While loop Do while loop
What Is a Program? A program is like an algorithm, but describes a process that is ready or can be made ready to run on a real computer Retrieved from:
Introduction to Python
Lists in Python.
An Introduction to Java – Part I, language basics
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
CS190/295 Programming in Python for Life Sciences: Lecture 6
PHP.
Logic Gates.
CS 100: Roadmap to Computing
Coding Concepts (Basics)
Web DB Programming: PHP
Sridhar Narayan Java Basics Sridhar Narayan
LabVIEW.
Python Tutorial for C Programmer Boontee Kruatrachue Kritawan Siriboon
Topics Sequences Introduction to Lists List Slicing
Python Primer 1: Types and Operators
For loops Taken from notes by Dr. Neil Moore
Topics Sequences Lists Copying Lists Processing Lists
Introduction to Computer Science
Topics Sequences Introduction to Lists List Slicing
And now for something completely different . . .
Introduction to Programming
General Computer Science for Engineers CISC 106 Lecture 03
CS 100: Roadmap to Computing
While Loops in Python.
Class code for pythonroom.com cchsp2cs
Introduction to Python
Introduction to Computer Science
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

Introduction to Python Usman Roshan

Python Interpreter language: the Python interpreter executes each statement one at a time. No compilation or linking is required. Python programs are called scripts which are simple text files. To execute a script we pass it through the interpreter.

Data types Basic data types Collections Integer Float String Boolean (true or false) Collections Lists Dictionaries (hash tables) Sets And more…

Expressions Numeric operators such as +, -, *, /, ** Logical operators such as and and or String operators such as in, +, [], [:] String and numeric functions such as len, abs, max, and min.

Assignment name = value Examples: sequence = “ACCCATA” x = 5 y = x + 2

Lists Ordered collection of basic types Examples: Operations on lists Concatenate: list3 = list1 + list2 Access nth element: list1[n]

Dictionaries Dictionaries are like arrays, except that they are indexed by user defined keys instead of non-negative integers. Example h={‘A’:’T’, ‘C’:’G’} Operations on dictionaries Lookup: h[key]

Input and Output Input and output to files is done by creating a file object open(path, mode) Example: f = open(“myfile.txt”,”r”) f.readline()

Control structures Conditional statements if expression : statements1 else: statements2 Example max = 0 if(x > y): max = x max = y

Iteration for count in range(start,stop,step): for item in collection: statements for item in collection: do something with item