|||

Y9 – AU1.3 – Casting and Arithmetic

Accessibility Settings

⏱️ Do It Now

Create a OneNote Page
Copy both the title and DIN task – then complete the DIN task:

Y9 – AU1.3 – Casting and Arithmetic

πŸ“ Do It Now
Answer each of the following:
(1) Explain the difference between initialisation and assignment

(2) Describe how an fString works

(3) Explain why programmers add comments to their code

πŸ› Lesson Slideshow


πŸŽ“ Lesson Activities

  • Activity 1
  • Activity 2
  • Calculator
  • Demonstration 1 Code
  • Files and Folders Explained

⌨️ Activity 1 – Data Types Explained

  1. Create a new subheading in OneNote called:

    “Activity 1 – Data Types Explained”

  2. Explain what each data type is and what it is used for in programming.
    To support each explanation, provide a suitable example.

Include the following data types:

  • Integer (int)
  • Float (float)
  • String (str)
  • Boolean (bool)

⌨️ Activity 2 – Casting Explained

  1. Create a new subheading in OneNote called:

    “Activity 2 – Casting Explained”

  2. Screenshot the code into OneNote.

  3. Explain what is meant by casting.
  4. Explain which parts of the code are performing the casting.
  5. Explain what the original data type was and what data type it was cast to.

Success Criteria βœ…

  • I can explain what casting means.
  • I can identify where casting takes place in the code.
  • I can identify the original data type.
  • I can identify the new data type after casting.
  • I can use correct programming terminology.

⌨️ Activity 3 – Your Own Calculator

Now it is time to extend your code:

  1. Make your calculator program carry out each of the other arithmetic operations.

  2. Make sure you add suitable comments into your code to explain what is happening.

  3. Screenshot your code and paste it into OneNote under the subheading:

    “Activity 3 – Arithmetic Operations”

Success Criteria βœ…

  • I can use multiple arithmetic operators in my program.
  • I can write meaningful comments to explain my code.
  • I can test my calculator program successfully.
  • I can organise my work in OneNote.
  • I can present my code clearly with screenshots.

πŸŽ“ Demonstration 1 – Working With Arithmetic

Copy this code into the file called: AU1.3 – Casting and Arithmetic

#------------------- Global Variables -----------------------
num1 = 0 # Initialising (creating) num1 to use later in the program

num2 = 0 # Initialising (creating) num2 to use later in the program

answer = 0 # Initialising (creating) answer to use later in the program

#------------------- Main Program ----------------------------

num1 = input("Enter number 1: ")

num2 = input("Enter number 2: ")

answer = num1 * num2

print(f"{num1} X {num2} = {answer}")

πŸ”—Useful Links:


πŸŽ“ Mini Whiteboard | πŸ“ Cornell Notes | πŸ—ΊοΈ Mind Map App |

πŸ‘₯ Peer Review |πŸ›°οΈ Jupyter Lite | πŸ€– AI Tutor | 🐍Snakify

⏲️ Time 2 Code | 🐍 TGGCS Python Projects | πŸ›°οΈData Rep | πŸͺ¨Runestone Python