Week 5 Computer Programming Year 9 – Unit 9.04

Slides:



Advertisements
Similar presentations
Using the Word Search Template Copy the PowerPoint presentation to your hard drive. Open the file in Microsoft PowerPoint. Go to Slide #3 – this shows.
Advertisements

Noadswood Science,  To know the basics of Python coding and decoding Monday, September 07, 2015.
Looping While-continue.
Control Structures FOR Statement Looping.
Section 3 Calculations National 4/5 Scratch Course.
Variables. Todays Lesson  In todays lesson you are going to:  Learn to use variables  Learn to ask for user input  Learn to save the users response.
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.
Advanced Work with Embedded and Summative Assessment Dr. Steve Broskoske Misericordia University EDU 533 Computer-based Education.
UFCEKS-20-2Multimedia Authoring Times Table Quiz.
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.
My Python Programmes NAME:.
Program #2 Algorithm for Parking at PSU. Understanding the Assignment You will be writing a program to find out how much someone at PSU might be spending.
Lesson 1. Security At the menu bar at the top you will see the word Tools. Click your mouse on Tools scroll down to Macro. Move the Mouse over and down.
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.
UFCFY5-30-1Multimedia Studio Scripting for Interactive Media Times Table Quiz This will contribute towards your online portfolio for this module.
Money Quiz!!!!. Write the question number and the answer in your maths book. How much money is shown? 1.
Money Quiz!!!!. Write the question number and the answer in your maths book. How much money is shown? 1.
1 Project 4: Computing Distance. 222 Computing Distance Write a program to compute the distance between two points. Recall that the distance between the.
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.
SMALL BASIC TO PYTHON CPD TRAINING CAS CPD. SCHEDULE 15:15 Refreshments 15: :45 Introduction 15: :45 Small Basic 16: :00 Python Workshop.
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.
Hardware & Software Lesson 1 Computer Systems & Components
Chapter 1 Connections to Algebra Review
How to change the LOGO on PecStarWeb V3.6
Week 4 Computer Programming Gray , Calibri 24
Basic operations in Matlab
Users and Accounts Lab 0.1. Users and Accounts Lab 0.1.
Lesson 1 Learning Objectives
Week 3 Computer Programming Learning Objective:
Sign Up Here.
Today’s lesson – Python next steps
Week 5 Computer Programming Gray , Calibri 24
Week 1 Computer Programming Year 9 – Unit 9.04
Use proper case (ie Caps for the beginnings of words)
Learning Outcomes –Lesson 4
Week 2 Computer Programming Learning Objective:
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.
Python Lessons 13 & 14 Mr. Kalmes.
Using the Word Search Template
For Wednesday No new reading No quiz.
HOW TO CREATE A CLASS Steps:
Task 1 Computer Programming LEVEL 6 PROGRAMMING:
Introduction to TouchDevelop
Week 4 Computer Programming Year 9 – Unit 9.04
CSC235 - Visual Studio Tutorial
Starter answer these questions in your book
Money Quiz!!!!.
Python 19 Mr. Husch.
Using screens and adding two numbers - addda.cbl
Programming Concepts and Database
Game Over Module 4 Lesson 2.
CSCI N207 Data Analysis Using Spreadsheet
Creating an Interactive Quiz
Using Script Files and Managing Data
Process Exchange Transactions Activity
Clear and Unclear Windows
Basic Lessons 5 & 6 Mr. Kalmes.
Chapter 1 Introducing Small Basic
Basic Mr. Husch.
Python 19 Mr. Husch.
Week 6 Computer Programming Gray , Calibri 24
Hint idea 2 Split into shorter tasks like this.
Dry Run Fix it Write a program
Agenda for Unit 5: Control Structures
Week 6 Computer Programming Year 9 – Unit 9.04
Creating an Interactive Quiz
GCSE Computing.
Python Creating a calculator.
Presentation transcript:

Week 5 Computer Programming Year 9 – Unit 9.04 Gray 80 69 69 69, Calibri 24 Dark Red RGB 153 0 0, Calibri 54

print("Sorry the answer was 4") Last week, you entered in this program called MathsQuiz.py print("What is 2 + 2?") answer = input () answer = int(answer) if answer == 4: print("Well done") else: print("Sorry the answer was 4") It would be good to have 5 questions, rather than just 1. Copy the code in your program and paste it below for each new question… see next slide for example.

Question 1 Question 2 Question 3

(score is a new variable) With just a few lines of extra code, it should be possible to maintain a score throughout a game and then give the user some feedback at the end. score = 0 #this defines variable score, and sets it as zero print("What is 2 + 2?") answer = input () answer = int(answer) if answer == 4: print("Well done") score = score + 1 #this increases score by one else: print("Sorry the answer was 4") (score is a new variable) Add the two highlighted lines of code to your FIRST question only

score = score + 1 #this increases score by one For the remaining 4 questions, just add the line score = score + 1 #this increases score by one …as shown below print("What is 13 + 80?") answer = input () answer = int(answer) if answer == 93: print("Well done") score = score + 1 #this increases score by one else: print("Sorry the answer was 93")

We would also like to show the score after the user has attempted answering the question. Remember, the score is stored in a variable called score and is simply print(score) score = 0 #this defines variable score, and sets it as zero print("What is 2 + 2?") answer = input () answer = int(answer) if answer == 4: print("Well done") score = score + 1 #this increases score by one else: print("Sorry the answer was 4") print(score)

print(“Your current score is: “ , score) A more sophisticated way of presenting the score could be… score = 0 #this defines variable score, and sets it as zero print("What is 2 + 2?") answer = input () answer = int(answer) if answer == 4: print("Well done") score = score + 1 #this increases score by one else: print("Sorry the answer was 4") print(“Your current score is: “ , score)

[name_variable], your score is [score_variable] If you can, do all these programs in SCRIPT mode (i.e. go to FILE, NEW WINDOW…then press F5 to run) Task: Amend your Maths Quiz program so that it prompts the end user for their name at the beginning of the program. When the score is displayed, it should show the message… [name_variable], your score is [score_variable] This should be displayed after each attempt at a question. Example Tim, your score is 1 Save your Maths Quiz game.