Input, Output and Variables GCSE Computer Science – Python.

Slides:



Advertisements
Similar presentations
Python November 14, Unit 7. Python Hello world, in class.
Advertisements

From Scratch to Python Learn to program like the big boys / girls!
Javascript and Basic Programming Concepts. What is a Program? A program is a specific set of instructions written in a computer language to perform a.
INTRODUCTION TO PYTHON. 1. The 5 operators in Python are: + - * / %
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
Data Types Integer 15 StringHelloThere! Float/Real BooleanYes / No CharP.
Java Data Types. Primitive Data Types Java has 8 primitive data types: – char: used to store a single character eg. G – boolean: used to store true or.
OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 6: Variables and constants.
3 - Variables Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
5 BASIC CONCEPTS OF ANY PROGRAMMING LANGUAGE Let’s get started …
Variables and Math in Code. Variables A variable is a storage block for information in your program “A” “A” Computer Program Memory Computer Program.
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.
Functions CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Math, Data Types. Python Math Operations OperationOperator Addition + Subtraction – Multiplication * Division (floating point) / Division (integer) //
ITEC 109 Lecture 7 Operations. Review Variables / Methods Functions Assignments –Purpose? –What provides the data? –What stores the data? –What type of.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 2A Reading, Processing and Displaying Data (Concepts)
Variables, Input, and Output. Challenge: ● Ask the user his or her name, and repeat that name to the user ● Pause video and try.
Variables and Expressions CMSC 201. Today we start Python! Two ways to use python: You can write a program, as a series of instructions in a file, and.
Data Types and Conversions, Input from the Keyboard CS303E: Elements of Computers and Programming.
A: A: double “4” A: “34” 4.
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,
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
GCSE Computing: Programming GCSE Programming Remembering Python.
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.
UFCFY5-30-1Multimedia Studio Coding for Interactive Media Fundamental Concepts.
CSC 108H: Introduction to Computer Programming Summer 2011 Marek Janicki.
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.
Numbers and arithmetic
GCSE COMPUTER SCIENCE Practical Programming using Python
Numbers and Arithmetic
Chapter 2 Basic Computation
Lesson 1 - Sequencing.
Data Types and Conversions, Input from the Keyboard
Variables, Expressions, and IO
Computer Science 3 Hobart College
Introduction to C++ October 2, 2017.
To write a Python program, you first need to open Pyscripter
What are variables? Using input()
Chapter 2.
Review Operation Bingo
Imperative Programming
Examples of Primitive Values
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.
Chapter (3) - Looping Questions.
Variables and Expressions
Feedback Pace Different ideas for delivery Debugging strategies
GCSE Computing Lesson 6.
We are starting JavaScript. Here are a set of examples
What are variables? Using input()
See requirements for practice program on next slide.
7 – Variables, Input and Output
Thinking about programming
Unit 3: Variables in Java
Java: Variables, Input and Arrays
Input and Output Python3 Beginner #3.
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.
Text Copyright (c) 2017 by Dr. E. Horvath
Input, Variables, and Mathematical Expressions
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.
More Basics of Python Common types of data we will work with
Imperative Programming
Data Types and Expressions
Introduction to Python
Python Creating a calculator.
Getting Started in Python
Presentation transcript:

Input, Output and Variables GCSE Computer Science – Python

Input To get input from a user: x = input(“What is your name?”) y = int(input(“Enter a number”))

Output To show output to a user: print (“hello”) print (67) print (x) If you’re printing a string, you need to include quotes. If you are printing a number or the contents of a variable, these are not needed.

Variables Variables in Python: Integer - No decimal places – 78 Float - Decimal places String - Text Boolean - True or False

Variables Variables are assigned a value using the = sign. x = “hello” pizza = 78 doobedoobedo = True

Converting Variable Types You want to convert a variable to a different type: str() int()

Maths With integer and float variables, you can do maths! addition = multiplication = 98 * 2 answer = multiplication + 4 print (answer)

Joining Strings (Concatenation) You can join (concatenate) strings (text) together using +: y = “hello ” x = “Joshua” print (y + x)

Joining Strings and Integers You can join (concatenate) a string (text) and integers (numbers) together. You will need to convert the integer into a string: y = “Your score was: ” x = 10 print (y + str(x))

Individual Tasks For each of the following tasks: Use Python (IDLE) to code the solution. Copy and paste your solution into this PowerPoint Presentation. You can add additional slides!

1. Allow the user to input two numbers, printing out the sum of the numbers.

2. Allow the user to input three numbers, printing out the sum of the first two numbers, multiplied by the third number.

3. Ask the user for their name. Say Hello. For example: If the user enters “Joshua”, print out “Hello Joshua”

4. Extend Task Three. After “Hello Joshua”, ask the user “How are you?”

5. Ask the user to enter a number between 1 and 100. Print out “Your score is: ” and their number.

6. Extend Task Five. Print out “Your Score is: “ double (x2) their number.

7. Ask the user for their name, their age and where they live. Print out their name, age and where they live using full sentences! For example: If the user enters “Derby”, print out “You live in Derby”