ICS3U Python Programming Evaluation 5

Instructions

These ICS3U Grade 11 Computer Science python coding questions will form a part of your final grade for this course and are to be handed in for grading. 

For ALL of the following questions:

  • Use a Python IDE of your choice (Spyder, IDLE, Pycharm, etc) and create a coded solution to all the given problems.
  • Hand in a commented .py file for your solutions

FOR THE LAST QUESITON ONLY:

  • Demonstrate that you have used the INPUT –  PROCESSING – OUTPUT Problem Solving Process and that you have Evaluated your solution
  • You must hand in this evidence (pictures / screen shots)
  •  

Your grade will be based on your ability to demonstrate the overall expectations from the Ontario Computer Studies Curriculum

A1 – Data Sequencing 

  • Use variables to carry out mathematical calculations in a computational problem

A2 – Selection and Repetition Structures

  • Incorporate selection structures into a computer program.
  • Incorporate repetition structures into a computer program

A4 – Code Maintenance

  • Write code that is readable using proper naming, indenting, and commenting conventions
  • Test program thoroughly to identify and correct errors

B1 – Problem Solving Strategies

  • Incorporate the Input – Processing – Output model of problem solving

B2 – Planning

  • Describe the structure of a program using pseudocode or flow charts

B3 – Algorithm Design

  • Design and implement algorithms that solve problems

ICS3U Python Programming Evaluation Question 1

File Name: “ICS3UmouseMoving.py”

Suppose that the bottom left hand corner of your screen is (0,0) and that all points on the screen are given by integer coordinates. When a mouse is moved it sends a pair of integers (A,B) indicating that the cursor should be moved A units in the x direction and B units in the y direction from its previous position. 

Your job is to read in the motions of the mouse and output the new position of the mouse. Keep in mind that if the mouse hits the boundary of the screen, it must stop moving ONLY IN THAT DIRECTION, it can still move in the other axis. The end of the mouse motion will be indicated by an input of (0,0)

Remember this is just a simulation of mouse movement…. you aren’t expected to know how to find the “real” location of your mouse on the screen.  You are just typing in motions from the keyboard

Here is a sample of what your Input / Output might look like

ICS3U Python Programming Evaluation Question 2

File Name: “ICS3UinTheCircle.py”

You are writing a program that checks if a point (a,b) is inside a circle of radius R that is centered on the point (c,d).

  • a,b,c,d,R are all integers entered from the keyboard
  • Do not allow negative R values to be entered
  • The output can be a simple statement indicating if the (a,b) point is “In the Circle”, “Out of the Circle”, “On the Circle”
  • Also output the Quadrant (I,II,III, IV) that the point (a,b) is located in. If the point happens to be on either the x or y axis, then output which axis it is on.

Your program is to continue forever until a radius of 0 is entered.

Note:  If you are wondering about how to compute the distance between 2 points…. use the Pythagorean Theorem

 

ICS3U Python Programming Evaluation Question 3

File Name: “ICS3Usteps.py”

A person walks a random amount of steps forward, and then a different random number of steps backwards. 

  • The random steps are anywhere between 2 and 20
  • The number of steps forward is always greater than the number of steps backwards
  • That motion of forward / backward random steps repeats itself again and again
  • The motion is consistent (the number of forward steps stays the same throughout the motion, and the number of backwards steps stays the same throughout the motion)

After making a specific amount of total steps the person is told to stop and will be a certain amount of steps forward from where they started.  

  • The total number of steps is generated randomly and will be between 10 and 85

You are writing a program to simulate the motion taken by the person.

  • Display that motion and the number of steps he ends away from where he started.

For Example:  

  • If the program generated the forward steps to be 4, and the backward steps to be 2, and the total number of steps to be 13, your program would display:
    • FFFFBBFFFFBBF = 5 Steps from the start
  • If the program generated the forward steps to be 5, and the backward steps to be 3, and the total steps to be 16, your program would display
    • FFFFFBBBFFFFFBBB = 4 Steps from the start