Learning Basic Python Amlan Talukder.

Slides:



Advertisements
Similar presentations
ARDUINO CLUB Session 1: C & An Introduction to Linux.
Advertisements

Chapter 3 DATA: TYPES, CLASSES, AND OBJECTS. Chapter 3 Data Abstraction Abstract data types allow you to work with data without concern for how the data.
Intro to Python Welcome to the Wonderful world of GIS programing!
Visual Basic for Applications. What it does Extends the features and built in functions of Excel – Create and run VB procedures – Some may be easy to.
ECS 15 if and random. Topic  Testing user input using if statements  Truth and falsehood in Python  Getting random numbers.
What is a scripting language? What is Python?
CSC 9010: Natural Language Processing
PYTHON: LESSON 1 Catherine and Annie. WHAT IS PYTHON ANYWAY?  Python is a programming language.  But what’s a programming language?  It’s a language.
Game Programming © Wiley Publishing All Rights Reserved. The L Line The Express Line to Learning L Line L.
 Computer Science 1MD3 Introduction to Programming Michael Liut Brandon Da Silva
Computing Subject Knowledge Enhancement Python. SESSION OUTLINE Audit of your current position Practical Investigation GCSE Controlled Assessment Q&A.
CS140: Intro to CS An Overview of Programming in C by Erin Chambers.
Python  By: Ben Blake, Andrew Dzambo, Paul Flanagan.
Introduction to Python Lecture 1. CS 484 – Artificial Intelligence2 Big Picture Language Features Python is interpreted Not compiled Object-oriented language.
An Introduction to Textual Programming
Introduction to Python
Introduction to Programming Workshop 1 PHYS1101 Discovery Skills in Physics Dr. Nigel Dipper Room 125d
Python Basic Syntax. Basic Syntax - First Program 1 All python files will have extension.py put the following source code in a test.py file. print "Hello,
Introduction to Python September 26, /10/ Bioinformatics Languages Low-level, compiled languages: C, C++, Java… Pros: performance Cons:
Computer Science 101 Introduction to Programming.
USING UNITY JAVASCRIPT. CONVENTIONS AND SYNTAX IN JAVASCRIPT Case Sensitivity All keywords like var or function must be in lowercase. All variable names,
Getting Started with Python: Constructs and Pitfalls Sean Deitz Advanced Programming Seminar September 13, 2013.
Variables When programming it is often necessary to store a value for use later on in the program. A variable is a label given to a location in memory.
CSC 110 Using Python [Reading: chapter 1] CSC 110 B 1.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
You Need an Interpreter!. Closing the GAP Thus far, we’ve been struggling to speak to computers in “their” language, maybe its time we spoke to them in.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
Python Let’s get started!.
Introduction to Objective Caml. General comments ML is a purely functional language--there are (almost) no side effects There are two basic dialects of.
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
A Tutorial on the Python Programming Language. Overview Running Python and Output Data Types Input and File I/O Control Flow Functions.
The If Statement There are no switch statements in Python. You need to use just if statements. There are no switch statements in Python. You need to use.
Xi Wang Yang Zhang. 1. Easy to learn 2. Clean and readable codes 3. A lot of useful packages, especially for web scraping and text mining 4. Growing popularity.
Introduction to Programming Python Lab 7: if Statement 19 February PythonLab7 lecture slides.ppt Ping Brennan
Introduction to Programming Oliver Hawkins. BACKGROUND TO PROGRAMMING LANGUAGES Introduction to Programming.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #003 (February 14, 2015)
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.
Mr. Crone.  Use print() to print to the terminal window  print() is equivalent to println() in Java Example) print(“Hello1”) print(“Hello2”) # Prints:
CPSC 233 Tutorial January 21 st /22 nd, Linux Commands.
Input, Output and Variables GCSE Computer Science – Python.
MET4750 Techniques for Earth System Modeling MET 5990 Techniques for Earth System Modeling and Research (
Foundations of Programming: Java
Fundamentals of Programming I Overview of Programming
CST 1101 Problem Solving Using Computers
MET4750 Techniques for Earth System Modeling
Introduction to Python
Intro To Pete Alonzi University of Virginia Library
Basic operators - strings
Lecture 1 Introduction to Python Programming
Variables, Expressions, and IO
Principles of Computing – UFCFA3-30-1
Engineering Innovation Center
Introduction to Python
An Introduction to Java – Part I, language basics
Learning Outcomes –Lesson 4
Escape sequences: Practice using the escape sequences on the code below to see what happens. Try this next code to help you understand the last two sequences.
Sridhar Narayan Java Basics Sridhar Narayan
Python Basics with Jupyter Notebook
Nate Brunelle Today: Conditional Decision Statements
Let’s start from the beginning
What are variables? Using input()
Input and Output Python3 Beginner #3.
General Computer Science for Engineers CISC 106 Lecture 03
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
L L Line CSE 420 Computer Games Lecture #3 Introduction to Python.
Class code for pythonroom.com cchsp2cs
Python Open source Many applications Python 3 jupyter notebook
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

Learning Basic Python Amlan Talukder

Why Python? Easier language to code Can get things done faster in less effort Easier language to learn Platform independent

How to install Python (Windows/Mac) https://www.python.org/downloads/

How to install Python (Linux) sudo apt-get install python (Debian/Ubuntu) sudo yum install python (RedHat/CentOS/Fedora)

Useful python resources Online tutorial http://www.learnpython.org/ Book Dive into Python

How to run Python Open “Command Prompt” in Windows OS or “Terminal” in Linux/MAC OS Type the following command to run a code file named “mypython.py”

How to run Python Open a program named “IDLE (Python GUI)” Open your python source file “mypython.py” in IDLE Type print ‘Hello World’ in the editor Click “Run -> Run Module” to run the code

Python variables No need to declare the type of a variable Any variable type can be converted into another type Variable Types: int (Any integer, ex: 0, 12, 29, 998) float (Any floating point number, ex: 12.3652) str (Any text, ex: ‘The sky is blue’ or “The quick brown fox”) bool (True or False) For single line comment, use ‘#’ and for multiline comment, use ”””

Python variables

Condition statements if <statement>: <do something> else: <do something else> if <statement>: <do something> elif <another statement>: <do something else> else:

Loops in Python

Functions in Python

List List is a collection of objects (variables or other lists or dictionaries)

List functions A[x], get element in list A at position x A.append(x), append x to A list A.insert(p,x), insert x to A at position p A. index(x), get the first position of x in A, error it not found A.count(x), get the occurrence of x in A A.sort(reverse=True/False), sort list A. True/False set the sorting order. A[x:y] , get the subset of list A from position x to position y.

String functions

String functions A[x], get the element at position x of A len(A), get the length of string A A.upper(), get all uppercase of string A A.lower(), get all lowercase of string A A.split(), split string A with specific separator. .join(Asplit), join the list of strings Asplit with a separator A[x:y], the substring of A from x to y

List comprehension

File read/write

Basic operators and “math” library +, -, *, /, **, +=, -=, %, and, or, =, == math.sqrt(number) math.pow(number, power) math.log(number) math.ceil(number) math.floor(number)

Basic operators and “math” library

Questions?