To write a Python program, you first need to open Pyscripter

Slides:



Advertisements
Similar presentations
Python. What is Python? A programming language we can use to communicate with the computer and solve problems We give the computer instructions that it.
Advertisements

Rules of Integers. Positive numbers are numbers that are above zero. Negative numbers are numbers below zero.
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 #001 (January 9, 2015)
Programming Test #1 Solutions. Multiple Choice 1. B) the grammar of the coding language 2. C) String 3. A) Single 4. C) 2Burgers4Me 5. B) Design Time.
Python Programming Using Variables and input. Objectives We’re learning to build functions and to use inputs and outputs. Outcomes Build a function Use.
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.
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.
My Python Programmes NAME:.
Math, Data Types. Python Math Operations OperationOperator Addition + Subtraction – Multiplication * Division (floating point) / Division (integer) //
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
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.
Introduction to Programming Python Lab 5: Strings and Output 05 February PythonLab5 lecture slides.ppt Ping Brennan
Calculator Program Explained by Arafa Hamed. First Designing The Interface Ask yourself how many places are there that will be used to input numbers?
Introduction to Programming
GCSE Computing: Programming GCSE Programming Remembering Python.
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.
Getting Started With Python Brendan Routledge
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.
Math, Data Types. Python Math Operations OperationOperator Addition + Subtraction – Multiplication * Division (floating point) / Division (integer) //
GCSE COMPUTER SCIENCE Practical Programming using Python Lesson 4 - Selection.
Introduction to Programming
Introduction to Programming
Numbers and arithmetic
GCSE COMPUTER SCIENCE Practical Programming using Python
Numbers and Arithmetic
Whatcha doin'? Aims: To start using Python. To understand loops.
A Playful Introduction to Programming by Jason R. Briggs
Introduction to Programming
Lesson 1 - Sequencing.
Introduction to Programming
Lesson 1 An Introduction
Computer Science 3 Hobart College
Lesson 3 - Repetition.
Introduction to Programming
Lesson 1 Learning Objectives
Chapter 4 LOOPS © Bobby Hoggard, Department of Computer Science, East Carolina University / These slides may not be used or duplicated without permission.
G7 programing language Teacher / Shamsa Hassan Alhassouni.
Selection CIS 40 – Introduction to Programming in Python
More Loops.
More Loops.
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Learning Outcomes –Lesson 4
Introduction to Programming
Task 1 Computer Programming LEVEL 6 PROGRAMMING:
G7 programing language Teacher / Shamsa Hassan Alhassouni.
Introduction to Programming
Introduction to Programming
1-8 Multiplying and Dividing Integers
Inputs and Variables Programming Guides.
Python programming exercise
Introduction to Programming
Beginning Python Programming
Basic Lessons 5 & 6 Mr. Kalmes.
Introduction to Programming
Input and Output Python3 Beginner #3.
Introduction to Python
Introduction to Python programming for KS3
Basic Mr. Husch.
Input, Variables, and Mathematical Expressions
Asking Questions in BYOB Scratch.
Starter Which of these inventions is: Used most by people in Britain
What you need to do… Drag the pieces of code into the correct order like you can see in the EXAMPLE below. print ( “ int input ) = + Hello world chr ord.
Hardware is… Software is…
H446 Computer Science.
Python Creating a calculator.
Presentation transcript:

To write a Python program, you first need to open Pyscripter To write a Python program, you first need to open Pyscripter. Go to the shared area\ICT\Portable Python and double click on Pyscripter-Portable.exe

You will see a screen like the one below You will see a screen like the one below. Remove the code in the main window and then you’re ready to go!

Now press the run button: Your first program: Hello world Type the below code into the main window: print(“Hello World”) Now press the run button: You should see the output: Now try to get it to output ‘Hello (Your Name)’

Next we’re ready to use variables: someText = input(“What is your name?”) print(“Welcome ” + someText) Now see if you can get the computer to also ask what your favourite colour is and what your favourite animal is. Then it should output a sentence like: Your teacher will show you this video to help understand variables (until 1min 30s): http://www.youtube.com/watch?v=aeoGGabJhAQ

Time to do some calculations, try each of these: print(137+172) print(200-132) print(1234*67) print(12000/4)

Now try this: someNumber = 345 anotherNumber = 457 Print(someNumber + anotherNumber) Now try dividing, multiplying and subtracting someNumber and anotherNumber

We can now try making a calculator by asking for two numbers and storing them in variables: num1 = input(“Enter the first number”) num2 = input(“Enter the second number”) However, the computer will assume these numbers are text, so now we have to convert them to numbers (integers): num1 = int(num1) num2 = int(num2)

Now try to get the computer to print the answer to num1 multiplied by num 2 And try to get the computer to print the answer to num1 added to num 2

You can make it a bit more user friendly by putting some additional text in: print(“The answer to “ , num1 , “ multiplied by “ , num2 , “ is: “ , num1*num2)

Now it’s time to make a miles to kilometres converter program Can you make a program that: - Asks how many miles you would like to convert - Stores the answer in a variable - Converts the contents of that variable into a number - Multiplies the number of miles by the number of kilometres in a miles (you can find this information out on the web) - Prints out the answer saying something like “The number of kilometres in 6 miles is 9.65 kilometres”