Lesson 4 - Challenges.

Slides:



Advertisements
Similar presentations
Top-Down Design CSC 161: The Art of Programming Prof. Henry Kautz 9/16/2009.
Advertisements

True BASIC Ch. 6 Practice Questions. What is the output? PRINT X LET X = -1 PRINT X FOR X = 4 TO 5 STEP 2 PRINT X NEXT X PRINT X END.
OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 7: Program flow control.
Simple Python Loops Sec 9-7 Web Design.
Noadswood Science,  To know the basics of Python coding and decoding Monday, September 07, 2015.
COMPE 111 Introduction to Computer Engineering Programming in Python Atılım University
An Introduction to Textual Programming
Bug Session Four. Session description Objectives Session activities summary Resources Prior knowledge of sequencing instructions using Bug Bug website.
More While Loop Examples CS303E: Elements of Computers and Programming.
Python Programming Using Variables and input. Objectives We’re learning to build functions and to use inputs and outputs. Outcomes Build a function Use.
Python Repetition. We use repetition to prevent typing the same code out many times and to make our code more efficient. FOR is used when you know how.
Scratch Programming Lesson 4 Question asking and answering.
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.
Python Programming Using Variables and input. Objectives We’re learning to use basic knowledge of variables combined with user input. Outcomes Continue.
CSC 110 Using Python [Reading: chapter 1] CSC 110 B 1.
Make a dice challenge! This is a starter activity and should take 5 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.Copy the code below in.
Sequencing The most simple type of program uses sequencing, a set of instructions carried out one after another. Start End Display “Computer” Display “Science”
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
Coding Time This is a starter activity and should take about 10 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.Start a script session (Select.
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 7: if Statement 19 February PythonLab7 lecture slides.ppt Ping Brennan
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.
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.
Input, Output and Variables GCSE Computer Science – Python.
GCSE COMPUTER SCIENCE Practical Programming using Python Lesson 4 - Selection.
PYTHON PROGRAMMING Year 9. Objective and Outcome Teaching Objective Today we will look at conditional statements in order to understand how programs can.
Scratch Programming Cards
GCSE COMPUTER SCIENCE Practical Programming using Python
GCSE COMPUTER SCIENCE Practical Programming using Python
Create Your Own Quiz using_Python KS3 COMPUTING KS3 Computing
Whatcha doin'? Aims: To start using Python. To understand loops.
Lesson 1 - Sequencing.
Week of 12/12/16 Test Review.
Lesson 1 An Introduction
ECS10 10/10
IF statements.
Introduction to Programming
Programming 101 Programming for non-programmers.
Lesson 3 - Repetition.
Starter Write a program that asks the user if it is raining today.
Iterations Programming Condition Controlled Loops (WHILE Loop)
Lesson 1 Learning Objectives
Logical Operators and While Loops
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Introduction to Programming
And now for something completely different . . .
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
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.
Multiple Selections (ELIF Statements)
Introduction to TouchDevelop
Introduction to Programming
Inputs and Variables Programming Guides.
Python programming exercise
PYTHON: BUILDING BLOCKS Sequencing & Selection
Flowcharts and Pseudo Code
A LESSON IN LOOPING What is a loop?
Logical Operators and While Loops
Python Basics with Jupyter Notebook
Programming In Lesson 4.
Using Script Files and Managing Data
Programming with Python, for beginners
Input and Output Python3 Beginner #3.
Introduction to Programming
Python 10 Mr. Husch.
Primary School Computing
Starter Look at the hand-out.
GCSE Computing.
Flow Control I Branching and Looping.
Presentation transcript:

Lesson 4 - Challenges

Python Where do you find Python? How do you start a new program? Start / Computer / ICT (I:) / Python / IDLE In Python go to: File / New File How do you run a program? What is a string? Press the F5 key (on the top row) A sentence. And it is usually in green surrounded by quote marks and brackets.

Last Lesson for x in range (1, 5): print (x * 6) You learnt about For loops What do the following two programs do? for x in range (1, 5): print (x * 6) for x in range (1, 51): print (x * 9)

Last Lesson subject = ”computing” guess = ”” while guess != subject: You learnt about While loops What does the following program do? subject = ”computing” guess = ”” while guess != subject: guess = input("Please guess my favourite subject: ")) print("You guessed the correct subject!")

Sequence Challenge 1 name = input(“???“) print(”??? ” + name) Create a program to ask the user their name and output it once they press Enter on the keyboard. Create one variable called name. Use one print statement. Make use of the + sign in the final line. HELP name = input(“???“) print(”??? ” + name) MORE HELP Save it as seqchal1.

Sequence Challenge 2 Create three variables. Create a program to ask the user their name, age and favourite subject. This should be output using one print statement. Create three variables. Remember int when working with numbers. Use one print statement on the final line. Make use of multiple + signs in the final line. HELP name = input(“???“) age = int(input(“???“)) school = input(“???“) print(”??? ” + name + “ ???” +…) MORE HELP Save it as seqchal2.

The rest of the program must be indented. Repetition Challenge 1 Add the following lines at the top of your previous program. This will make the program loop indefinitely. flag = True while flag == True: The rest of the program must be indented. flag = True While flag == True: name = input(“???“) age = int(input(“???“)) school = input(“???“) print(”??? ” + name + “ ???” +…) HELP

Make use of multiple + signs in the final line. Selection Challenge 1 Create a program to ask the user their age and if it is 18 or more it should output, you are an adult, otherwise it should output you are a child. It should loop. Create one variable. Use an If Else command. Make use of multiple + signs in the final line. Use a While loop. HELP age = int(input(“???“)) if ??? >= ???: print(”???”) else: MORE HELP Save it as selchal1.

Selection Challenge 2 Create one variable. Use an If Else command. Create a program to ask the user their age and if it is between 4 and 16 it should output “You are in school”, otherwise output “You are not of school age”. Create one variable. Use an If Else command. Use more than one operator < and >. Make use of the AND keyword after the IF statement. HELP age = int(input(“???“)) if ??? >= ??? and ??? <= ???: print(”???”) else: MORE HELP Save it as selchal2.

Use a While loop to make this program repeat. Selection Challenge 3 Create a program to ask the user the direction they would like to go in. If they go left it displays “You have gone into a cave”, if they say right it displays “You have fallen off the cliff!”. Otherwise it should say, “You are stuck on an endless path.” direction = input(“???”) if direction.lower() == “left”: print(“???”) elif direction.lower() == “???”: print(“??? ”) else: print(“You are stuck..”) HELP Use a While loop to make this program repeat. Save it as selchal3.

Create a program to output the 7 times table up to 10. Repetition Challenge 2 Create a program to output the 7 times table up to 10. Set x to 1. Use a For loop. Remember the first number in a loop is where it starts, and it finishes before the final number. HELP for x in range (1,???): print (x * ???) MORE HELP Save it as repchal2.

Repetition Challenge 3 Use a For loop. Create a program to ask the user to print out the cubed numbers from 13 to 103. Use a For loop. Remember the first number in a loop is where it starts, and it finishes before the final number. HELP for x in range (1,???): print (x * ??? * ???) MORE HELP Save it as repchal3.