CMPUT174 Lecture Notes - Lecture 6: Delimiter, Function Type, Code Segment
ceruleanzebra152 and 30 others unlocked
25
CMPUT174 Full Course Notes
Verified Note
25 documents
Document Summary
Q1 modify the given code such that it satisfies the requirement of limiting literals as specified in. Section 6 of the software quality test document. # display icon window. set_font_size(100) window. set_font_color("green") icon_width = window. get_string_width("ua") surface_width = window. get_width() icon_x_coord = surface_width - icon_width window. draw_string("ua", icon_x_coord, 0) window. set_font_size(18) window. set_font_color("white") # display icon icon_string = "ua" icon_font_size = 100 icon_color = "green" regular_font_size = 18 regular_font_color = "white" window. set_font_size(icon_font_size) window. set_font_color(icon_color) icon_width = window. get_string_width(icon_string) surface_width = window. get_width() icon_x_coord = surface_width - icon_width window. draw_string(icon_string, icon_x_coord, 0) window. set_font_size(regular_font_size) window. set_font_color(regular_font_color) Q2 modify the given code such that it satisfies the requirement of replacing all adjacent line groups with iteration as specified in section 5 of the software quality test document. # display instructions string_height = window. get_font_height() y_coord = 0 str_list = ["welcome to number game", "you will be asked to", "guess a number", "you win if you guess correctly"] for message in str_list: window. draw_string(message, 0, y_coord) y_coord = y_coord + string_height.