Thursday 14 May 2015

Python Session 4 - Maths

Using Python Basics - Level 1 

Lesson Objectives
 - use maths operators successfully in Python






Starter
Have a go at the following in Interactive Mode:
Read the Maths section of Python Basics on pg 19 - 20


Main

Python is great for maths tasks, today you will investigate some of it's powerful tools.

Red Task



~~~Evidence~~~
1. Put some evidence of using Maths symbols in Python on your blog and annotate to explain what you've done



Amber Task
Combining text and maths - copy the code on pg 21

Try the same calculations but this time use // instead of /.

Question?
Can you explain the difference between
 / (divide normal) and // (divide integer)?



Extension Challenges
1. Save as garden.py
Write a program that asks the user for the length and width of their garden and then calculates the total area.

Tip: Area = Length * Width

2. 1. Save as garden2.py
Write a program that asks the user for the length and width of their garden and the radius of the circular flower bed then calculates the total area of turf needed.
Tip: Area = Length * Width - (3.14 * Radius) * (3.14 * Radius) 


Green Task
Embed the following video clip to your blog, using the HTML function:
Video Clip - http://youtu.be/BvgPM9-krOY

Plenary
Further reading - http://learnpythonthehardway.org/book/ex3.html

No comments:

Post a Comment