Design & Technology Grade 7 Python

Slides:



Advertisements
Similar presentations
Types and Arithmetic Operators
Advertisements

Introduction to C Programming
Introduction to C Programming
Class 7.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming Expressions and Operators Program Style.
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
Python November 14, Unit 7. Python Hello world, in class.
Variables, Data Types, & Arithmetic Expressions CSC 1401: Introduction to Programming with Java Lecture 3 Wanda M. Kunkle.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to Python Programming Outline 2.1 Introduction 2.2 First Program in Python: Printing.
Introduction to C Programming
Introduction to Python
Munster Programming Training
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Programming in Python Part I Dr. Fatma Cemile Serçe Atılım University
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 2 Input,
1 CSC103: Introduction to Computer and Programming Lecture No 6.
Input, Output, and Processing
Computer Science 101 Introduction to Programming.
1 INTRODUCTION TO PROBLEM SOLVING AND PROGRAMMING.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Lecture 2: Introduction to C Programming. OBJECTIVES In this lecture you will learn:  To use simple input and output statements.  The fundamental data.
C++ Basics. Compilation What does compilation do? g++ hello.cpp g++ -o hello.cpp hello.
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.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
 2007 Pearson Education, Inc. All rights reserved. A Simple C Program 1 /* ************************************************* *** Program: hello_world.
Scott Marino MSMIS Kean University MSAS5104 Programming with Data Structures and Algorithms Week 1 Scott Marino.
Introduction to Algorithmic Processes CMPSC 201C Fall 2000.
Introduction to Python Lesson 2a Print and Types.
Lecture2.
Bill Tucker Austin Community College COSC 1315
Fundamentals of Programming I Overview of Programming
Chapter 2 Variables.
Topics Designing a Program Input, Processing, and Output
Chapter 2 Introduction to C++ Programming
Input and Output Upsorn Praphamontripong CS 1110
BASIC ELEMENTS OF A COMPUTER PROGRAM
Lecture 4: Expressions and Variables
Topic: Python’s building blocks -> Statements
Data Types and Conversions, Input from the Keyboard
Chapter 2 - Introduction to C Programming
Introduction to Programming
Variables, Expressions, and IO
Chapter 2 - Introduction to C Programming
Building Java Programs Chapter 2
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
Introduction to C++ Programming
Lecture 2 Python Programming & Data Types
Chapter 2 - Introduction to C Programming
Chapter 2 Variables.
Chapter 2 - Introduction to C Programming
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
Lecture3.
Lecture 2 Python Programming & Data Types
CS150 Introduction to Computer Science 1
Core Objects, Variables, Input, and Output
CS150 Introduction to Computer Science 1
Topics Designing a Program Input, Processing, and Output
Lecture 4: Expressions and Variables
Topics Designing a Program Input, Processing, and Output
Chapter 2 - Introduction to C Programming
Unit 3: Variables in Java
Chapter 2 Variables.
Understanding Variables
Introduction to C Programming
Data Types and Expressions
Introduction to Python
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

Design & Technology Grade 7 Python Python Introduction

Input Date Processing Out Put Information Program Editor Compiler Problem Programmer Algorithm flowchart Program Editor Compiler Real Program Run Input Date Processing Out Put Information

Python is a programming Language Python = Program (Script ) is list of instructions or statements Statement = Syntax (Format ) Syntax = Spelling & Grammar

Displaying String Output String output: A message appears onscreen that consists of a series of text characters. Print statement ( syntax ) Format: print ("the message that you wish to appear")

Print (“I love “ + “ Python “) The Print Statement To Display output Print ( constant ) Print (“ string “ ) Print (Expression ) Print ( Mixed ) Print ( variable ) Print (5) Print (“Python”) Print ( 5+6) Print (“I love “ + “ Python “) Print (5, “ICT”,1+2)

Arithmetic Operators Operator Description Example = Assignment num = 7 + Addition num = 2 + 2 - Subtraction num = 6 - 4 * Multiplication num = 5 * 4 / Division num = 25 / 5 % Modulo num = 8 % 3 ** Exponent num = 9 ** 2 num = 9//2 divide //

Parenthesis ( ) Power ** Multiplication * , / Addition + , - Order Of Operation Parenthesis ( ) Power ** Multiplication * , / Addition + , - Left to Right

Variables Format: Examples: Num = 5 X =2.3 Firstname = “Basma” <name of variable> = <Information to be stored in the variable> Examples: Num = 5 X =2.3 Firstname = “Basma”

Variables Naming Must start with a letter Case Sensitive Can’t be Python Key word Prefer Meaningful capitalizing the first letter of each word

Variables Naming Myage = 5 FirstName =“Basma” HourWork=8 RateperHour=50 Side_Squar=10

Input Statement The computer program getting string information from the user. Strings cannot be used for calculations (information getting numeric input will provided shortly). Format: <variable name> = input("<Prompting message>") Example: name = input ("What is your name: ") Print ( name )

Converting Between Different Types Of Information (2) Example motivation: you may want numerical information to be stored as a string (for the formatting capabilities) but also you want that same information in numerical form (in order to perform calculations). Some of the conversion mechanisms available in Python: Format: int (<value to convert>) float (<value to convert>) str (<value to convert>) Examples: Program name: convert1.py x = 10.9 y = int (x) print (x, y)