Python Basics with Jupyter Notebook

Slides:



Advertisements
Similar presentations
Getting Input in Python Assumes assignment statement, typecasts.
Advertisements

Python Syntax. Basic Python syntax Lists Dictionaries Looping Conditional statements.
True BASIC Ch. 6 Practice Questions. What is the output? PRINT X LET X = -1 PRINT X FOR X = 4 TO 5 STEP 2 PRINT X NEXT X PRINT X END.
CS150 Introduction to Computer Science 1
Introduction to Python
Chapter 2 Writing Simple Programs
Testing a program Remove syntax and link errors: Look at compiler comments where errors occurred and check program around these lines Run time errors:
INTRODUCTION TO PYTHON PART 3 - LOOPS AND CONDITIONAL LOGIC CSC482 Introduction to Text Analytics Thomas Tiahrt, MA, PhD.
Python quick start guide
Python Programming Fundamentals
An Introduction to Textual Programming
A Level Computing#BristolMet Session Objectives U2#S6 MUST identify different data types used in programming aka variable types SHOULD describe each data.
CH Programming An introduction to programming concepts.
Python Repetition. We use repetition to prevent typing the same code out many times and to make our code more efficient. FOR is used when you know how.
For loops in programming Assumes you have seen assignment statements and print statements.
Last Week if statement print statement input builtin function strings and methods for loop.
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.
Ch. 10 For Statement Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2012.
CSC 110 Using Python [Reading: chapter 1] CSC 110 B 1.
Counter-Controlled Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Review the following : Flowcharting Variable declarations Output Input Arithmetic Calculations Conditional Statements Loops.
End of unit assessment Challenge 1 & 2. Course summary So far in this course you have learnt about and used: Syntax Output to screen (PRINT) Variables.
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.
Python 101 Dr. Bernard Chen University of Central Arkansas PyArkansas.
Last Week Modules Save functions to a file, e.g., filename.py The file filename.py is a module We can use the functions in filename.py by importing it.
Data Types and Conversions, Input from the Keyboard CS303E: Elements of Computers and Programming.
1 CS 177 Week 6 Recitation Slides Review for Midterm Exam.
Data Types and Conversions, Input from the Keyboard If you can't write it down in English, you can't code it. -- Peter Halpern If you lie to the computer,
Midterm Exam Topics (Prof. Chang's section) CMSC 201.
I NTRODUCTION TO PYTHON - GETTING STARTED ( CONT )
Introduction to Programming Python Lab 7: if Statement 19 February PythonLab7 lecture slides.ppt Ping Brennan
For Loop GCSE Computer Science – Python. For Loop The for loop iterates over the items in a sequence, which can be a string or a list (we will discuss.
Python Flow of Control CS 4320, SPRING Iteration The ‘for’ loop is good for stepping through lists The code below will print each element in the.
Chapter 6 Controlling Program Flow with Looping Structures.
PH2150 Scientific Computing Skills Control Structures in Python In general, statements are executed sequentially, top to bottom. There are many instances.
Input, Output and Variables GCSE Computer Science – Python.
GCSE COMPUTER SCIENCE Practical Programming using Python Lesson 4 - Selection.
Python Basics.
Chapter 2 Writing Simple Programs
GCSE COMPUTER SCIENCE Practical Programming using Python
Pseudocode Key Revision Points.
Topic: Iterative Statements – Part 1 -> for loop
Week of 12/12/16 Test Review.
Python Let’s get started!.
Data Types and Conversions, Input from the Keyboard
Lesson 4 - Challenges.
Learning Intention Learning Intention: To develop understanding of variables, data types, and comments in text based programming languages Context: Sequencing.
Introduction to Programming
Lesson 3 - Repetition.
While Loops in Python.
CSc 110, Spring 2017 Lecture 8: input; if/else
Python I/O.
Use proper case (ie Caps for the beginnings of words)
Validations and Error Handling
An Introduction to Python
Multiple Selections (ELIF Statements)
Module 4 Loops.
Suppose I want to add all the even integers from 1 to 100 (inclusive)
Python programming exercise
Programming Dr. Jalal Kawash.
Understanding Code Workshop 2.
Java: Variables, Input and Arrays
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.
Hint idea 2 Split into shorter tasks like this.
Class code for pythonroom.com cchsp2cs
Intro to Programming (in JavaScript)
COMPUTING.
The Python interpreter
Python Creating a calculator.
Presentation transcript:

Python Basics with Jupyter Notebook Workshop 1

Download Anaconda Visit anaconda.com/download and download the relevant distribution for your operating system. Download Anaconda with Python 3.7

Open Jupyter Notebook

Print Statements The print function in Python allows you to output data to the user. You can print items of different datatypes including string, int and lists. Try outputting some text on your notebook.

Storing data in variables You can store data in variables using the ‘=’ operator. Try figuring out how the code below works

Taking inputs Use the input function to prompt user to enter some data. Data stored in a given variable.

Changing the datatype Sometimes in Python you have to change the datatype of a variable. An example of this is when user input is taken, it is stored as a string. If the input an integer, you must convert the string to an integer if you want to apply any operations to the data. Converts input to an integer

If, else and elif statements In Python you can run code based on decisions using if statements.

Lists Lists allow you to store multiple data items under one variable.

Accessing list items You can access items in a list by using variableName[index] Python indexes start with 0 so the first item is variableName[0]

For Loops For Loops allow you to repeat a portion of the program a number of time. A variable assigned loops through items in a list.

Range range(a,b) creates a list of numbers starting with a and ending in b-1. The first parameter is inclusive but not the second parameter.

Functions Python lets you create your own functions. Each function takes parameters as input and ‘returns’ a result.