Question: # Import standard Python modules needed to complete this assignment. # You should not need to use any other modules for your solution. # In

# Import standard Python modules needed to complete this assignment.
# You should not need to use any other modules for your solution.
# In particular, your solution must NOT rely on any non-standard
# Python modules that need to be downloaded and installed separately,
# because the markers will not have access to such modules.
from turtle import *
from math import *
from random import *
from sys import exit as abort
from os.path import isfile
# Confirm that the student has declared their authorship
if not isinstance(student_number, int):
print('
Unable to run: No student number supplied',
'(must be an integer), aborting!
')
abort()
if not isinstance(student_name, str):
print('
Unable to run: No student name supplied',
'(must be a character string), aborting!
')
abort()
# Import the functions for setting up the drawing canvas
config_file = 'assignment_1_config.py'
if isfile(config_file):
print('
Configuration module found ...
')
from assignment_1_config import *
else:
print(f"
Cannot find file '{config_file}', aborting!
")
abort()
# Define the function for generating data sets in Task 1B,
# using the imported raw data generation function if available,
# but otherwise creating a dummy function that just returns an
# empty list
data_file = 'assignment_1_data.py'
if isfile(data_file):
print('Data generation module found ...
')
from assignment_1_data import raw_data
def data_set(new_seed = randint(0,99999)):
return raw_data(new_seed) # return the random data set
else:
print('No data generation module available ...
')
def data_set(dummy_parameter = None):
return []
#
#--------------------------------------------------------------------#
#-----Student's Solution---------------------------------------------#
#
# Complete the assignment by replacing the dummy function below with
# your own function and any other functions needed to support it.
# All of your solution code must appear in this section. Do NOT put
# any of your code in any other sections and do NOT change any of
# the provided code except as allowed by the comments in the next
# section.
#
# All of your code goes in, or is called from, this function.
# In Task 1B ensure that your code does NOT call functions data_set
# or raw_data because they're already called in the main program
# below.
def visualise_data(rename_me_in_task_1b):
pass # <--- Replace this statement with your solution
#
#--------------------------------------------------------------------#
#-----Main Program to Run Student's Solution-------------------------#
#
# This main program configures the drawing canvas, calls the student's
# function and closes the canvas. Do NOT change any of this code
# except as allowed by the comments below. Do NOT put any of
# your solution code in this section.
#
# Configure the drawing canvas
#
# ***** You can add arguments to this function call to modify
# ***** features of the drawing canvas such as the background
# ***** and line colours, etc
create_drawing_canvas()
# Create the data set and pass it to the student's function
#
# ***** While developing your Task 1B code you can call the
# ***** "data_set" function with a fixed seed below for the
# ***** random number generator, but your final solution must
# ***** work with "data_set()" as the function call,
# ***** i.e., for any random data set that can be returned by
# ***** the function when called with no seed
visualise_data(data_set()) # <-- no argument for "data_set" when assessed
# Exit gracefully
#
# ***** Do not change this function call
release_drawing_canvas(student_name)
#

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!