PROGRAMMING In. Objectives  We’re learning to develop basic code with the use of the correct syntax and variables. Outcomes  Explain what syntax is.

Slides:



Advertisements
Similar presentations
PROGRAMMING In. STARTER Using the internet…Find … what does case sensitive mean what a programming language is.. 3 benefits of Python.
Advertisements

COMPUTER PROGRAMMING Task 1 LEVEL 6 PROGRAMMING: Be able to use a text based language like Python and JavaScript & correctly use procedures and functions.
Programming in python Lesson 2.
Python Programming Chapter 2: Variables, expressions, and statements Saad Bani Mohammad Department of Computer Science Al al-Bayt University 1 st 2011/2012.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
PROGRAMMING In. STARTER Using the internet…Find …  what does “case sensitive” mean  what a programming language is..  3 benefits of Python.
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.
PYTHON: LESSON 1 Catherine and Annie. WHAT IS PYTHON ANYWAY?  Python is a programming language.  But what’s a programming language?  It’s a language.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
An Introduction to Textual Programming
Introduction to Python
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Hello World 2 What does all that mean?.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #001 (January 9, 2015)
General Programming Introduction to Computing Science and Programming I.
Python Programming Introduction to programming using python.
PYTHON. Python is a high-level, interpreted, interactive and object- oriented scripting language. Python was designed to be highly readable which uses.
First Program  Open a file  In Shell  Type into the file: 3  You did it!!! You wrote your first instruction, or code, in python!
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Programming in Python Part I Dr. Fatma Cemile Serçe Atılım University
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Input, Output, and Processing
Do it now activity Last term we learnt about how data is represented in a computer and about how to identify different volumes of data. How many bits in.
Unit 3 Day 6 FOCS – Web Design. Journal Unit #3 Entry #4 Write the source code that would make the following display on a rendered page: Shopping List.
Python Programming Using Variables and input. Objectives We’re learning to build functions and to use inputs and outputs. Outcomes Build a function Use.
Type accurately challenge! This is a starter activity and should take 2 minutes [ slide 1 ] 1.Can you type out the code in Code Box 2.1 with no errors.
Basic of Programming Language Skill Area Computer System Computer Program Programming Language Programmer Translators.
Lesson 4 Using Variables in Python – Creating a Simple ChatBot Program.
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.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
PROGRAMMING In Lesson 2. STARTER ACTIVITY Complete the starter activity in your python folder – lesson 2 Now we will see how you got on and update your.
Variables, Expressions and Statements
Introduction to Computer Programming
Introduction to Python Lesson 1 First Program. Learning Outcomes In this lesson the student will: 1.Learn some important facts about PC’s 2.Learn how.
Solving One-Step Equations Jennifer Barrall 9 th Grade Algebra Click to Continue.
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.
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.
C++ LANGUAGE TUTORIAL LESSON 1 –WRITING YOUR FIRST PROGRAM.
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
NAME Python Programming Workbook Select a Lesson:
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.
First Program  Open a file  In Shell  Type into the file: 3  You did it!!! You wrote your first instruction, or code, in python!
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
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.
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.
PROBLEM SOLVING WARM-UP Fill in the spaces using any operation to solve the following (!, (), -/+,÷,×): = 6.
Introducing Python Introduction to Python.
GCSE COMPUTER SCIENCE Practical Programming using Python
Lesson 1 - Sequencing.
Introduction to Python
Lesson 1 An Introduction
Variables, Expressions, and IO
Today’s lesson – Python next steps
Programming In Lesson 3.
Learning Outcomes –Lesson 4
Escape sequences: Practice using the escape sequences on the code below to see what happens. Try this next code to help you understand the last two sequences.
Hello World! Syntax.
PYTHON: BUILDING BLOCKS Sequencing & Selection
Programming In Lesson 4.
Programming In.
Introduction to Python
Introduction to Python programming for KS3
Starter Which of these inventions is: Used most by people in Britain
Hardware is… Software is…
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

PROGRAMMING In

Objectives  We’re learning to develop basic code with the use of the correct syntax and variables. Outcomes  Explain what syntax is and why it’s required.  Explain the use of variables.

OBJECTIVES  Learn about python as a programming language  Learn about expressions & variables and their use  Create several successful programs O UTCOMES  All-State what a programming language is and what a program is. Get half marks on the test (7/15)  Most- Have used variables and with help get 75% on the test (12/15)  Some- Written their own programs and independently got maximum marks on the test.

STARTER Using the internet…Find …  what does “case sensitive” mean  what a programming language is..  3 benefits of Python

PYTHON  Python is a programming language  A set of words and rules for instructing a computer to perform specific tasks.computer  The term programming language usually refers to high-level languages, such as BASIC, C, C++, Python etchigh-level languagesBASICCC++  Each Programming language has a set of keywords and a special syntax for writing program instructions.Programming languagekeywordssyntaxprograminstructions

Learning to program is going to be fun – so lets keep it simple. org 100h main proc mov ah,9 ; mov dx,offset hello_message int 21h : retn hello_message db 'Hello, world!$' main endp end main print ("Hello, World!“) #include int main() { std::cout << "Hello World!" << std::endl; return 0; } C++ Assembler python WHY PYTHON

WHAT IS A PROGRAM  Programming is not telling the computer what you want to do….it is telling it EXACTLY HOW to do it (remember the student robot?!!)  A program is a sequence of instructions that specifies how to perform a computation.  The computation might be something mathematical, such as solving a system of equations  It can also be a symbolic computation, such as searching and replacing text in a document or moving a graphic icon (sprite) on a game.  You can think of a program like a recipe.  It contains a list of ingredients called “Variables”.  You can store many different types of information in a variable such as:  Data  Text  Images  A variable on it’s own is like a bucket….  You can get constant variables though…

TRADITION  It is tradition that the first program everyone creates is to say Hello world”.  From the start menu – all programs / python 3.4 / IDLE  MAKE SURE YOU ARE IN THE PYTHON SHELL  Enter the following and press enter print (“Hello, World”) This one If you see this window on top – look for the python shell window.

EXPRESSIONS – LOOK AT THE EXPRESSIONS BELOW. WHAT ANSWER DO YOU THINK THEY WILL RETURN? Now try typing these expression in idle, pressing return after each one print ( ) print (8*6) print (10-5+6) print ( 2 + 2)

EXPRESSIONS You have been using expressions 2 values and an operator Even the follows this rule Operators, you already know. Perhaps the multiplication is written differently as a * (on the number pad) At the moment python is acting like a calculator. 2+2 addition 2-2 subtraction 2*2 multiplication 2/2 division

SYNTAX In computer science, the syntax of a programming language is the set of rules that define the combinations of symbols that are considered to be correctly structured programs in that language.computer scienceprogramming languageprograms Aka syntax means that special key words and characters combine to result in a program.

SYNTAX  The syntax of a programming language is the set of rules that control if a program is correct.programming language  You tried print (“Hello, World”) and it worked – a correct program.  Try these print hello print (hello) PRINT(“hello”) print (a + b) print (5 + 6 / 7 +)  Syntax is CRITICAL in programming. A computer cannot take an educated guess at your instructions.  Computers just follow exactly what you tell them to do.

SYNTAX ERRORS Extension: - Now type out: print (hello world) What happens? SYNTAX ERROR Like with English, programming languages have their own check similar to a grammar check. When you run code it checks to see whether it is in the form for the computer to compute. If you do not do this the computer throws out an error like above.

VARIABLES Variables are like a bucket, they’re used to store a number, data, text or image. You can empty it or refill it as many times as you like. When we use variable in our code the computer uses the value in the variable. To store the value 15 in the variable and display it spam = 15 print (spam) Try it. Now try these spam = spam + 12 print (spam) spam = spam + spam print (spam) spam = spam * spam print (spam)

VARIABLES This time we have 2 variables eggs and fizz You can assign them by eggs = 15 fizz = 10 What be the output of the following, go on try it. print( eggs ) print( eggs + fizz ) spam = eggs + fizz print( spam ) eggs = fizz print( eggs ) print( EGGS ) >>>nothing 25 >>>nothing 10 Traceback (most recent call last): File " ", line 1, in EGGS NameError: name 'EGGS' is not defined In python eggs is not the same as EGGS. Python is case sensitive which means YOU MUST BE CAREFUL

COMBINE VARIABLES  You can do the same with numbers, for example:  Using number3 you can combine your sentence with the text you stored in your variable. You could do the same with names or other values. Notice the Comma separating it.

Show a syntax error and annotate it to explain it. Show how to print text or numbers. Show how to carry out calculations with numbers. Show use of variables through either calculation or text. See if you can make a sentence with the use of two variables.

COMPLETE SELF ASSESSMENT QUIZ Complete Self Assessment quiz from lesson 1 folder you copied at the start of the lesson. And update your self-evaluation for this lesson.