Introduction to Python

Slides:



Advertisements
Similar presentations
Foundations of Programming and Problem Solving Introduction.
Advertisements

Computer and Programming
Java Intro. Strings “This is a string.” –Enclosed in double quotes “This is “ + “another “ + “string” –+ concatenates strings “This is “ “ string”
Introduction to Python. Outline Python IS ……. History Installation Data Structures Flow of Control Functions Modules References.
Week 1 basic Python programs, defining functions Special thanks to Scott Shawcroft, Ryan Tucker, and Paul Beck for their work on these slides. Except where.
Introduction to Python
Recitation 1 Programming for Engineers in Python.
Week #2 Java Programming. Enable Line Numbering in Eclipse Open Eclipse, then go to: Window -> Preferences -> General -> Editors -> Text Editors -> Check.
V Avon High School Tech Club Agenda Old Business –Delete Files New Business –Week 18 Topics: Intro to HTML/CSS: Questions? Summer Work Letter.
An Introduction to Textual Programming
Session 2 Wharton Summer Tech Camp 1: Basic Python 2: Start Regex.
Introduction to Python By Neil Cook Twitter: njcuk Slides/Notes:
A First Look at Java Chapter 2 1/29 & 2/2 Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education - Prentice Hall, 2010.
Intro to Python Adriane Huber Debbie Bartlett Python Lab #1Python Lab #1 1.
An Introduction to Java – Part 1 Dylan Boltz. What is Java?  An object-oriented programming language  Developed and released by Sun in 1995  Designed.
CSC1030 HANDS-ON INTRODUCTION TO JAVA Introductory Lab.
Introduction to Python Damian Gordon. The Python Programming Language Python was developed by Guido van Rossum in the Netherlands in Van Rossum.
Week 1 basic Python programs, defining functions Special thanks to Scott Shawcroft, Ryan Tucker, and Paul Beck for their work on these slides. Except where.
Component 4: Introduction to Information and Computer Science Unit 5: Overview of Programming Languages, Including Basic Programming Concepts Lecture 3.
By Austin Laudenslager AN INTRODUCTION TO PYTHON.
Object Oriented Programming (OOP) LAB # 1 TA. Maram & TA. Mubaraka TA. Kholood & TA. Aamal.
INTEL ULTIMATE ENGINEERING EXPERIENCE. INTRODUCTIONS.
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
Introduction to Python Developed by Dutch programmer Guido van Rossum Named after Monty Python Open source development project Simple, readable language.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
PYTHON PROGRAMMING. WHAT IS PYTHON?  Python is a high-level language.  Interpreted  Object oriented (use of classes and objects)  Standard library.
CPSC 233 Tutorial January 21 st /22 nd, Linux Commands.
Introduction to Programming using Java Day 3 and 4 Java Language Basics Review The “For” loop Subroutines The “String” class.
Fundamentals of Programming I Overview of Programming
Programming For Big Data
Whatcha doin'? Aims: To start using Python. To understand loops.
Intro To Pete Alonzi University of Virginia Library
Introduction to the JES environment and basics of Python
basic Python programs, defining functions
Introduction to Programmng in Python
Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during.
Chapter 4 – Control Structures Part 1
CSE1320 INTERMEDIATE PROGRAMMING
CSE1320 INTERMEDIATE PROGRAMMING
TK1114 Computer Programming
SELECTION STATEMENTS (1)
1 Python Lab #1 Intro to Python Adriane Huber Debbie Bartlett.
VISUAL BASIC.
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:
CSE341: Programming Languages Section 1
basic Python programs, defining functions
An Introduction to Java – Part I, language basics
CSE341: Programming Languages Section 1
An Introduction to Python
CS190/295 Programming in Python for Life Sciences: Lecture 6
CSE1320 INTERMEDIATE PROGRAMMING
T. Jumana Abu Shmais – AOU - Riyadh
CSE1320 INTERMEDIATE PROGRAMMING
Introduction to programming with Python
CS 200 Loops Jim Williams, PhD.
CS110D Programming Language I
A look at Python Programming Language 2018.
Introduction to Programming with Python
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
Building Java Programs
Introduction to Value-Returning Functions: Generating Random Numbers
Chapter 3 Selections Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved.
Python Basics with Jupyter Notebook
Recitation #1 Tel Aviv University 2017/2018 Slava Novgorodov
Introduction to Matlab
Recitation #1 Tel Aviv University 2016/2017 Slava Novgorodov
CYB 130 RANK Dreams Come True / cyb130rank.com.
Installations for Course
Installations for Course
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

Introduction to Python Fondren Library Digital Scholarship Services

Name comes from “Monty Python” Open source WHAT IS PYTHON? Invented by a Dutch programmer Guido van Rossum as a “hobby” during Christmas week, 1989 Name comes from “Monty Python” Open source Companies: Instagram, Amazon, Facebook, SurveyMonkey… Design philosophy: “Readability counts” Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

Why PYTHON? #Python print ("Hello world!" ) #Java public class Main { public static void main(String[ ] args) { System.out.println( "Hello, World!’’ ); } Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

One of the most popular programing languages Top Ten Languages of 2018 Source: Google Trend Top Ten Languages of 2018 Source: IEEE(Institute of Electrical and Electronics Engineers) Spectrum’s fifth annual interactive ranking of the top programming languages Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

PYTHON IS USED FOR Web Development (Django Web Framework, eg. Pinterest, Instagram) Data Analysis Data Visualization Web Scraping Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

Works on Linux, Windows, and Mac 1400+ packages pre-installed Over 6 million users Works on Linux, Windows, and Mac 1400+ packages pre-installed IDEs including: Jupyter, JupyterLab, Spyder, and RStudio Anaconda Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

DATA TYPES Python knows various types of data. Common ones are: Strings – “a”, “hi” Integer numbers – 2, 4, 6, Floating point numbers – 3.14, 2.0, 2.12 Boolean – True/False Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

CHECK AND CHANGE TYPES BUILT-IN FUNCTION type Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

PRINT TEXT "escape" character. Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

Digital Scholarship Services | Email mr66@rice. edu | library. rice Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

USE AS A CALCULATOR MATHEMATIC OPERATORS +, -, /, *, % # Exercise 1: # Radius=5, π=3.14, calculate the area of the circle Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

OPERATORS WORK DIFFERENTLY BASE ON DATA TYPE Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

LOGIC OPERATORS <, >, ==, LOGIC OPERATORS <, >, ==, !=, <=, >= AND STATEMENTS and, or, not RETURN BOOLEAN DATA TYPE Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

ASSIGNING VARIABLES Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

Built-In Function INPUT #Exercise 2: Create a variable affiliation, prompt a question, "Are you a student or a staff member?" print "You are a " + input Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

USER-DEFINED FUNCTION Exercise 3: Create a BMI function and calculate BMI for person1 and person2. BMI = weight/height² # person1: height:1.65m, weight:60kg # person2: height:1.75m, weight:75kg Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

BASIC DATA STRUCTRUES IN PYTHON Lists [1,2,3] ordered and changeable Tuples (1,2,3) ordered and unchangeable Dictionary {‘a’: 1, ‘b’:2, ‘c’:3} changeable, key-value pairs Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

LIST Create a list: Add Items: Remove Items: Access item: Change Item Value: Exercise 4: Create a list of your favorite songs, print the list Print the 3rd item in the list Change the 3rd item into another song Add one more song Remove one song Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

CONTROL FLOW – IF/ELSE Exercise 5: Create a variable called "behavior", assign a value "good" to it # if "good" print "candy" # elif "bad" print "no candy" # else print "ask your mom" Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

CONTROL FLOW – FOR LOOP Exercise 6 Create a list called “animals" and put "cat","dog","pig"...in it Use for loop to print each one out Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

Useful Libraries Beautiful Soup – web scraping NumPy – advance math functionalities Matplotlib – graphs Pandas – data structures and data analysis tools Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss

What Does Research Data Services Provide? https://library.rice.edu/research-data-services Offers Data @ Rice Workshops on Python, R, Excel, etc. Consults on managing data, acquiring data, using applications such as Python,R, SPSS & Excel, etc. Reviews draft data management plans Teaches custom workshops on request Data Office Hours Prefer a one-on-one consultation? Drop by our office hours 3:00 p.m.-4:00 p.m. on Tuesdays or 12:30-1:30 p.m. on Thursdays in the GIS-Data Center classroom (basement of Fondren Library), or schedule an appointment at https://library.rice.edu/data- assistance.

Tell us your thoughts https://library.rice.edu/requests/course-evaluation-form Digital Scholarship Services | Email mr66@rice.edu | library.rice.edu/dss