Python Basics. Topics Features How does Python work Basic Features I/O in Python Operators Control Statements Function/Scope of variables OOP Concepts.

Slides:



Advertisements
Similar presentations
Overview of programming in C C is a fast, efficient, flexible programming language Paradigm: C is procedural (like Fortran, Pascal), not object oriented.
Advertisements

1 pritisajja.info Unlocking the World of Java Programming….. Priti Srinivas Sajja February, 2014 Visit pritisajja.info for detail Future Technology for.
Programming in Visual Basic
What is a scripting language? What is Python?
CSE (c) S. Tanimoto, 2007 Python Introduction 1 Introduction to Python for Artificial Intelligence Outline: Why Python? Interactive programming,
Program Design and Development
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
CS241 PASCAL I - Control Structures1 PASCAL I - Control Structures Philip Fees CS241.
The Python Programming Language Matt Campbell | Steve Losh.
Introduction to Python (for C++ programmers). Background Information History – created in December 1989 by Guido van Rossum Interpreted Dynamically-typed.
1 CSC 221: Introduction to Programming Fall 2012 course overview  What did you set out to learn?  What did you actually learn?  Where do you go from.
Python Programming Fundamentals
4. Python - Basic Operators
 Value, Variable and Data Type  Type Conversion  Arithmetic Expression Evaluation  Scope of variable.
High-Level Programming Languages: C++
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.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 6 Value- Returning Functions and Modules.
1 Python CIS*2450 Advanced Programming Concepts Material for this lecture was developed by Dr. D. Calvert.
Introduction to Computational Linguistics Programming I.
Introduction to PythonIntroduction to Python SPARCS `08 서우석 (pipoket) `09 Summer SP ARCS Seminar`09 Summer SP ARCS Seminar.
Computer Science 101 Introduction to Programming.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
Group 4 Java Compiler Group Members: Atul Singh(Y6127) Manish Agrawal(Y6241) Mayank Sachan(Y6253) Sudeept Sinha(Y6483)
Introducing Python CS 4320, SPRING Resources We will be following the Python tutorialPython tutorial These notes will cover the following sections.
C463 / B551 Artificial Intelligence Dana Vrajitoru Python.
CSCI/CMPE 4341 Topic: Programming in Python Review: Exam I Xiang Lian The University of Texas – Pan American Edinburg, TX 78539
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
An Introduction. What is Python? Interpreted language Created by Guido Van Rossum – early 90s Named after Monty Python
CS105 Computer Programming PYTHON (based on CS 11 Python track: lecture 1, CALTECH)
CS241 PASCAL I - Control Structures1 PASCAL Control Structures Modified Slides of Philip Fees.
By Austin Laudenslager AN INTRODUCTION TO PYTHON.
A Tutorial on the Python Programming Language. Overview Running Python and Output Data Types Input and File I/O Control Flow Functions.
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
Midterm Exam Topics (Prof. Chang's section) CMSC 201.
Higher Computing Science 2016 Prelim Revision. Topics to revise Computational Constructs parameter passing (value and reference, formal and actual) sub-programs/routines,
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
C is a high level language (HLL)
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
PROGRAMMING USING PYTHON LANGUAGE ASSIGNMENT 1. INSTALLATION OF RASPBERRY NOOB First prepare the SD card provided in the kit by loading an Operating System.
PYTHON PROGRAMMING. WHAT IS PYTHON?  Python is a high-level language.  Interpreted  Object oriented (use of classes and objects)  Standard library.
Quiz 1 A sample quiz 1 is linked to the grading page on the course web site. Everything up to and including this Friday’s lecture except that conditionals.
Invitation to Computer Science 5 th Edition Chapter Ada Programming in Ada.
G. Pullaiah College of Engineering and Technology
Fundamentals of Programming I Overview of Programming
Programming For Big Data
Introduction to Python
Key Ideas from day 1 slides
Introduction Python is an interpreted, object-oriented and high-level programming language, which is different from a compiled one like C/C++/Java. Its.
Intro To Pete Alonzi University of Virginia Library
Object Oriented Programming
Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during.
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
PYTHON Varun Jain & Senior Software Engineer
And now for something completely different . . .
CSC1018F: Intermediate Python
Type & Typeclass Syntax in function
Python Tutorial for C Programmer Boontee Kruatrachue Kritawan Siriboon
Introduction to Programming Using Python PART 2
Introduction to Programming with Python
C Programming Getting started Variables Basic C operators Conditionals
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
Introduction to Value-Returning Functions: Generating Random Numbers
Fundamental Programming
Learning Python 5th Edition
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

Python Basics

Topics Features How does Python work Basic Features I/O in Python Operators Control Statements Function/Scope of variables OOP Concepts M T Savaliya

Features History Developed by Guido Van Rossum First public distribution – 1991 Versions Python 1.0 – 1994 Python 2.0 – 2000 Python M T Savaliya

Features Important Features Simple Open Source High-level Portable Object Oriented and Procedure Oriented Interpreted Easy to maintain Scalable M T Savaliya

How does Python work ? Editor -> Source File -> Interpreter -> Running Libray Modules M T Savaliya

Python Execution Source File (.py) Byte Code (.pyc) Runtime PVM M T Savaliya

Implementations CPython Written in C Language Standard library written C and Python Bycode compiled by CPython VM JPython From Java Platform Uses Java classes Complied to Java Byte code run by JVM Python.NET M T Savaliya

Installation and IDLE Install from Python IDLE (Python Integrated Development and Learning Environment) M T Savaliya

Basic Syntax Comments : starts with # Data types Numerical Integer Float Complex Boolean Compound (Sequences) String : Operations -> index, slice, concatanation List : use [ ] Tuple : use (), Immutable Identifiers, Keywords, Variables M T Savaliya

Input/Output Input : input() function Example : x = int(input(‘Enter a number : ‘)) Output : print() function Examples: print(x) print(x,y) print(x,y,sep=‘%’) print((“Value of x is”,x) print(“Value of x is {}’.format(x)) M T Savaliya

Operators Arithmetic operators + : Addition and concatenation - : Subtraction and difference * : Multiplication and repetition of data types / : Division % : Remainder ** : Power // : floor value of numbers Relational Operators : ==, !=, >, >=, <, <= M T Savaliya

Operators Logical : and, or, not Bitwise : &, |, ~, ^, >>, << Assignment : =, +=, … Membership : in, not in Identity (Memory Location) : is, not is Precedence and Associativity is Important M T Savaliya

Control Statements Conditional Statement If-elif-else (#calc) (#larger) Looping for loop (#fact) for iterating_var in sequence: statement(s) while loop while test_expression: statement(s) M T Savaliya

Control Statements break and continue statements else clause with for and while loop (#prime) M T Savaliya

Function Independent piece performing well defined task Supports Modularity Syntax def name(parameter list) statement(s) return [expression] Calling a function name(parameters) Or var = name(parameters) M T Savaliya

Function Parameters Format parameters Actual parameters Arguments Default Keyword Arbitrary Recursion M T Savaliya

Function Anonymous or lambda functions lambda arguments: expression Scope of variable Local Global M T Savaliya

References: Star Python, STAR Certifications Programming Through Python, Savaliya, Maurya, Magar, STAREDU Solutions Examples: programming/examples M T Savaliya