QUESTION 3 The following Python code segment uses information supplied in a list
ID: 3740986 • Letter: Q
Question
QUESTION 3 The following Python code segment uses information supplied in a list called data_set. Each element of data_set is a triple (ie, three values), specifying certain properties for drawing a dot in Turtle. The properties include the co-ordinates for the location of the dot's centre on the Turtle canvas and a string representing the colour of the dot to be drawn. The size of the dot depends on its position. Note that all of the dots must be drawn on the left hand side of the canvas. for data in data set: penup () goto (data[1], data[0]) color (data[2]) pensize (abs (data [1])/10) dot O Your task is to determine which of the following are valid values for data set, in order to produce such a drawing in Turtle data set-[lred, S. -5, blue,10, -100], (green, 200,-200], [yellou, -100,-150 data set-[ts. -50. 'red', [10, 100, blue'1, [200, -200, 'green'1. [-100, -150, 'yellou' data_set0,5,'red'1, [-100,10, 'blu -200, 200, green'1, -150,-100, 'yellow'11 data set -[l-50.'red', 51. [-100, blue', 101. [-200, 'green', 200]. [-150, 'yellow', -100 data set [['red., -50,5), [.blue',-100, 101, ['green', -200, 200), ['yellow. , -150, -100?? . - data-set [ [ , red, , 5, -50] , [ 'blue' , 10,-100), [ ' green. , 200,-200), [ ' yellow. , -100,-150] ]Explanation / Answer
as, we have in the given code,
color = (data[2])
so the the 3rd element of the list will be the color, which is of string type.
so we can remove the options a,d,e,f.
So we have only two possibilities b and c.
Now, Since the question asked, all the points should be on left side, which means, the x-cordinate of the dot will be negative (so that point is on left side), and the x cordinate is the 2nd element of the list.
So, correct option will be 2nd option, where all the x cordinated are negatve.
so correct option is data_set = [[5,-50,'red'],[10,-100,'blue'],[200,-200,'green'],[-100,-150,'yellow']]
If there is anything that you do not understand, then please mention it in the comments section,
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.