Presentation is loading. Please wait.

Presentation is loading. Please wait.

Python SAT 1 Feedback.

Similar presentations


Presentation on theme: "Python SAT 1 Feedback."— Presentation transcript:

1 Python SAT 1 Feedback

2 Entry Ticket: Calculating the areas

3 Learning Intentions Learning Intention
To review the first programming SAT To develop an understanding of how to decompose problems into smaller sub problems To develop an understanding of how to make code self-documenting Learning Outcomes Emerging Write programs for sub-parts of a mathematical problem Developing Solve a mathematical problem using self-documenting code Secure Write programs that solve a variety of mathematical challenges using self- documenting code

4 Self-Documenting Code: The Mark Scheme
Criteria Marks Available Mark Descriptor Marks to Award Written code that is self-documenting, well-structured and modular in nature 3 Uses whitespace, functions, or comments to divide program into sensible sections Uses comments to explain calculations Uses comments to explain inputs and outputs 1 Used a consistent programming style throughout, including indentation and the use of white space around operators and keywords Consistent indentation Consistent variable names (for example Hungarian notation) Consistent programming structure

5 Top-down programming There are 4 main principles to top-down programming: Commenting Self Identifying Variable Names Indentation Line Spacing

6 Commenting This is one of the most useful things which you can put into code because it allows you to write a small explanation of the section of coding so if you are unsure what the section does it will then tell you for example : Python coding for commenting = #

7 AgeVerify  bAgeVerify
Variable names USE HUNGARIAN NOTATION: Variable names which explain what they hold New words should start with a capital Start the variable name with the data type. E.g: Age  iAge Name  sName Pi  fPi AgeVerify  bAgeVerify

8 Indentation Programs are rarely written as a list of instructions. Parts of the code are 'indented' TAB Indentation When there is code inside the constructor make sure to indent. This allows you to see where if and else's are linked together as well as what code is in then if or the else statements.

9 Line spacing Programs should be spaced out. One endless block of code making up a program is harder to read Using line spacing you can make sure that all of section is there and is in the correct order because its like writing a piece of work without spaces in it. Example: Hellotherethisisunreadable. Hello there this is unreadable.

10 The problem A gardener needs to buy some materials for a project they are working on. The garden is rectangular with a circular flower bed in the middle. The gardener always estimates based on whole numbers for the dimensions of the garden. The gardener usually installs the same style of garden on most of their projects therefore the program in development should allow the gardener to input different sizes of lawn area and different sized flower beds. The gardener charges £4.54 m2 of turf including top soil. The gardener charges £6.75 m2 of flower bed including a mixture of flowers. The gardener charges a standard 40% of the total price as labour. When calculating his prices the gardener rounds each individual to the nearest penny.

11 Decomposing the problem
How do you solve this problem? What are the different components to this problem?

12 Calculating the Areas Area of the Flower Bed: Formula: 3.14 x Radius2 Data Required: Radius Area of the Garden: Formula: Height x Width Data Required: Height, Width Area of the Turfed Area: Formula: Area of Garden – Area of Flower Bed Data Required: Area of Garden, Area of Flower Bed

13 Calculating the Costs Cost of Flower Bed:
Formula: 6.75 x Area of Flower Bed Cost of Turf: Formula: 4.54 x Area of Turf Cost of Labour: You need to add the two other costs together and then increase if by 40% How would you do this?

14 Calculating the Labour Cost
To increase a value by 40% you can multiply it by 1.4 Cost of Labour: Formula: (Cost of Turf + Cost of Flower Bed) x 1.4

15 Have a go at programming the solution
Start off by getting the user to input the height and width of the garden, and radius of the flower bed. Calculate the: Area of the garden Area of the Flowerbed Area of the Turfed Area Calculate the Cost of: The Flowerbed The Turf The Labour Total Cost Output the: Flowerbed Cost Turf Cost Labour Cost

16 Extension Challenges Work through the following challenges – every time you complete one print off your code and output and stick it into your books.

17 PIN Number Challenges Thinking Tasks Programming Challenges
A personal identification number (PIN) is used at bank machines to allow you to take out your money. How many digits are in a normal PIN? How many different combinations could there be? How long would it take a human to type them all in? Why is it not possible for a human to do this? Approximately how long would it take a computer to generate all the possible PIN numbers? Write a program that prints all possible PIN numbers on the screen. Write a program that asks for a PIN number, checks it, and only lets you in if it is correct. Write a program that only lets you have three attempts at your PIN or the machine takes your bank card!

18 Strings and Things Thinking Time Programming Challenges
An anagram is a word that has had all the letters mixed up to make another word—how could a program do this? How many ways can you jumble up the letters in a word? Write a program that allows you to type in a sentence, which is printed in uppercase, lowercase, titlecase, capitalized, no spaces and swapped case. Write a program that will count how many letters are in a sentence. Write a program that allows you to type in your name with a mixture of upper and lower case, but it prints it out correctly. Write a program that allows you to type in a word, which is then sorted into a random order! Write a program that allows you to type in a sentence and it automatically removes all the vowels to turn it into text speak.

19 Thinking of a Number Thinking Time: Choose a random number
Programming Challenges Can humans choose random numbers? Can a computer choose a random number? Find out who E.R.N.I.E. is ? If you choose a number 1—1000 and tell the person higher or lower—how many guesses will they need? How many guesses will you need to guess a number between 1— ? Write a program that asks you to guess a number between 1— It tells you when you are correct and how many guesses you took. Write a program where the computer guesses a number you have chosen, you can enter higher or lower until it gets it right. The computer should try to make the smallest number of guesses.

20 Guess the number Game! I’ve used the code shown here to create a Guess the number game Make the following improvements: The program should tell the player whether their guess is Too High, or Too Low When they guess correctly, the program should tell them how many guesses it took Allow the player to choose the range of numbers to guess from


Download ppt "Python SAT 1 Feedback."

Similar presentations


Ads by Google