Lesson 6. Python 3.3 Objectives. In this lesson students will learn how to output data to the screen and request input from the user. Students will also.

Slides:



Advertisements
Similar presentations
Introduction to C Programming
Advertisements

 2000 Prentice Hall, Inc. All rights reserved. Chapter 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line.
1 9/1/06CS150 Introduction to Computer Science 1 What Data Do We Have? CS 150 Introduction to Computer Science I.
Introduction to Python
Moving To Code 3 More on the Problem-Solving Process §The final step in the problem-solving process is to evaluate and modify (if necessary) the program.
Sequencing Miss Regan. Blood Hound  Does anyone know what the Bloodhound project is?  Video 1 Video 1  Video 2 Video 2  Link to website Link to website.
From Scratch to Python Learn to program like the big boys / girls!
An Introduction to Textual Programming
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #002 (January 17, 2015)
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Data Types Integer 15 StringHelloThere! Float/Real BooleanYes / No CharP.
Variables and Expressions CMSC 201 Chang (rev )
PROGRAMMING In. Objectives  We’re learning to develop basic code with the use of the correct syntax and variables. Outcomes  Explain what syntax is.
Introduction to Computer Programming
Graphical User Interface You will be used to using programs that have a graphical user interface (GUI). So far you have been writing programs that have.
A first program 1. #include 2. using namespace std; 3. int main() { 4. cout
C++ Basics. Compilation What does compilation do? g++ hello.cpp g++ -o hello.cpp hello.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Sequencing The most simple type of program uses sequencing, a set of instructions carried out one after another. Start End Display “Computer” Display “Science”
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
Variables, Types, Expressions Intro2CS – week 1b 1.
Python Lesson 1 1. Starter Create the following Excel spreadsheet and complete the calculations using formulae: 2 Add A1 and B1 A2 minus B2 A3 times B3.
COMPUTER PROGRAMMING Year 9 – Unit 9.04 Week 3. Open the Python INTERPRETER Can you use the interpreter to solve these maths problems? 156 add
GCSE Computing: Programming GCSE Programming Remembering Python.
Programming In Python. Starter Using the internet… Find what a programming language is.
COMPUTER PROGRAMMING Year 9 – lesson 1. Objective and Outcome Teaching Objective We are going to look at how to construct a computer program. We will.
© 2006 Lawrenceville Press Slide 1 Chapter 4 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration statement. For example: Dim.
Getting Started With Python Brendan Routledge
Introducing Python 3 Introduction to Python. Introduction to Python L1 Introducing Python 3 Learning Objectives Know what Python is and some of the applications.
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
Introduction to Python Lesson 2a Print and Types.
Input, Output and Variables GCSE Computer Science – Python.
Chapter 3 Using Variables, Constants, Formatting Mrs. UlshaferSept
CMSC201 Computer Science I for Majors Lecture 03 – Variables
Introducing Python Introduction to Python.
A variable is a name for a value stored in memory.
what is computer programming?
Introduction to GIS PythonScript CGIS-NURIntroduction to ArcGIS II.
CMSC201 Computer Science I for Majors Lecture 02 – Intro to Python
Input and Output Upsorn Praphamontripong CS 1110
Introducing Instructions
Lesson 1 An Introduction
Computing Fundamentals
Design & Technology Grade 7 Python
Variables, Expressions, and IO
To write a Python program, you first need to open Pyscripter
Computational Thinking
Computational Thinking
Introduction to Python
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
Introduction to C++ Programming
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Chapter 2 - Introduction to C Programming
“If you can’t write it down in English, you can’t code it.”
Task 1 Computer Programming LEVEL 6 PROGRAMMING:
Chapter 2 - Introduction to C Programming
Topics Introduction to Functions Defining and Calling a Void Function
Chapter 2 - Introduction to C Programming
Beginning Python Programming
12th Computer Science – Unit 5
Programming In.
Introduction to Python
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.
Data Types and Maths Programming Guides.
Introduction to C Programming
Starter Which of these inventions is: Used most by people in Britain
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

Lesson 6

Python 3.3 Objectives. In this lesson students will learn how to output data to the screen and request input from the user. Students will also learn how to use variables to store data for use in their programs.

Python 3.3 We will be using Python 3.3 to learn the basic of programming and then have look at other languages if there is time. We will be using the IDLE Interface

Python 3.3 Programming involves using a set of instructions, data and keywords to tell the computer what to do. Your first program type and then press enter >>> print(“Hello World”)

Python 3.3 Which one of these is correct? >>> print"Hello World“ >>> print("Hello World"); >>> Print("Hello World") >>> print("Hel World") >>> prin(Hello World) Where do you look for errors? 1)Syntax Errors 2)Logical errors

Python 3.3 Task Using a script – create a program that produces three lines of text.

Python 3.3 Special characters in text \nCreates a line in a string of text \tCreates a tab style indent in a string of text \\Allows a backslash to appear in a string of text \”Allows a speech mark to be used in a string of text

Python 3.3 Variables Variables are containers that can hold data. In most languages variables are declared to be a certain data type first such as Strings, Integers, Dates, Real, Characters etc.. In python variables are declared when they have their first value assigned to them

Python 3.3 Variables Try the following program print("Hello this is a variable program") name = "" name = input("Enter in your name please: ") print("Hello ", name)

Python 3.3 Variables You can use variables to do calculations Try this program print("Hello this is a variable program") num1 = 0 num2 = 0 sum = 0 num1 = int(input("Enter in number 1 please: ")) num2 = int(input("Enter in number 2 please: ")) sum = num1 + num2 print("The total is ",sum)

Python 3.3 Tasks Watch the three python videos under lesson 01 and then answer the questions on the worksheet.

Python 3.3 String Functions. Len(variable) = returns length Variable.upper() – returns uppercase of string Variable.lower() – returns lowercase of string. Variable.capitalise() – Makes the first letter of the string capital. Variable.replace(“old word”,”new word”) – Replaces a word in a string with the new word.

Python 3.3 String Functions. astring = "Hello World" print(astring[:2]) print(astring[6:]) print(astring[:5]) Output – He World Hello Can you workout what the code is doing from the output?