Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please only use phyton and has to work on coderunner -the last three functions are listed below: Part 2: The Final Program [10 marks] Complete

please only use phyton and has to work on coderunner

-the last three functions are listed below:

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
Part 2: The Final Program [10 marks] Complete the A5 program so that it draws a pixel art pattern according to the filename entered by the user. Steps: 0 Copy the solution of the last three functions from CodeRunner into the A5.py le . Add your username to the title bar of the window. Currently the title bar of the program window displays "A5 by". Add your username to the title bar of the program (e.g. A5 by kngOOl). Add a docstring at the top of the le containing your name, username and a description of the program. 0 Complete the draw_pattern(a_canvas, colour_dictionary, pattern_list, size, start_x, Start_y) function The draw_pattem function is passed SIX parameters: the Canvas object, a colour dictionary, a list of String elements, and three integer parameters. The function draws a grid of coloured rectangles inside the canvas area. The left-top position of the grid of coloured rectangles is given by the last two parameter values and the size of each rectangle is given by the size parameter. def get_lines_from_file(filename) : lines = f = open(filename) for line in f: for word in line. strip(). split(): Lines . append(word. strip()) f. close() return linesdef create_colour_dictionary(col) : dictionary = dict() for i in range(len(col)): key_and_value = col[i] . split(":"> LO OO -JOUTAWNY key = key_and_value[0] value = key_and_value[1] dictionary [key ] = value return dictionarydef create_pattern_list(lines) : codes = T for line in lines: code = for char in line: code . append(char) codes . append(code) return codes

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions