Question

MUST BE IN PYTHON!!!!

PLEASE HELP WITH NUMBER 10 & 11A & 11B!!!

WIILL VOTE UP!!!

F=False boolExprs = [T and F, T or F, T and T, F or F trueCount = 0 for expr in boolExprs: if expr: trueCount += 1 print (tru

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Q10) Let us analyze the turtles movement for each value of i.

For i ==0 : Second condition is true , turtle pen remains up but turtle turns 90 degrees clockwise and finally faces downward. Turtle writes nothing.

For i==1: First condition is true. Turtle pen is down. It is already facing downwards and thus moves forward 100 units drawing a straight line.

For i==2: None of the condition is true. Nothing happens.

For i==3: Both conditions are true , due to the first condition turtle again moves 100 units downward because direction has remained same. Due to the second condition , pen is lifted and the turtle turn 90 degress clockwise. the turle is thus finally facing west.

So overall turtle draws a straight line of 200 units in length and finally faces westwards. Option (A) is correct.

Q11 A) Please read comments for clarification,

import turtle

def drawLine(turtle , length):
   turtle.down() #puts the turltes pen down if it was not down originally
   turtle.forward(length)    #moves the turtle length units forwars to draw a line

s= turtle.Screen()
t = turtle.Turtle()
drawLine(t,100)

Q11 B) Please read the comments for clarification.

import turtle

def spikes(numlines , lengthIncr , angle):
   # creating a turtle and screen
   s = turtle.Screen()
   t = turtle.Turtle()

   # put the turtle pen down and initiate the length of firstline
   t.down()
   lineLength = lengthIncr

#Loop to draw each line one by one

   for i in range(numlines):
       t.forward(lineLength) #move the turtle forward to draw a line
       t.backward(lineLength) #bring back the turtle to starting point
       lineLength += lengthIncr #increment line length for the next line
       t.right(angle) #turn the direction of turtle by angle degrees clockwise

spikes(20,10,18)

Add a comment
Know the answer?
Add Answer to:
MUST BE IN PYTHON!!!! PLEASE HELP WITH NUMBER 10 & 11A & 11B!!! WIILL VOTE UP!!!...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Answer must be in Python 3 Answer: import turtle def trifecta(size,angle,num): for i in range(num): tri(t,size)...

    Answer must be in Python 3 Answer: import turtle def trifecta(size,angle,num): for i in range(num): tri(t,size) t.right(angle) t = turtle.Turtle() s = turtle.Screen() trifecta(100,25,5) Question 11 Part b (10 points) Write a function named trifecta() that takes three parameters: 1. size 2. angle 3. num trifecta() should call tri() repeatedly so as to draw num triangles, each with sides of length size. Each triangle should be oriented angle degrees clockwise from the preceding triangle. trifecta() should create a turtle and...

  • Python 3.5 Code Part A: 10 points A tick is a short line that is used...

    Python 3.5 Code Part A: 10 points A tick is a short line that is used to mark off units of distance along a line. Write a function named drawTick() that uses a turtle parameter to draw a single tick of specified length perpendicular to the initial orientation of the turtle. The function drawTick() takes two parameters: 1. a turtle, t, that is used to draw 2. an integer, tickLen, that is the length of the tick When drawTick() is...

  • I need help with this code, I have it started here import sys import turtle menu...

    I need help with this code, I have it started here import sys import turtle menu = "Press 1 for Flower" UserChoice = input(menu) #function to draw squares def draw_square(square): for i in range(0,2): square.forward(100) square.right(70) square.forward(100) square.right(110) #function to draw flower def draw_flower(petalNumber): window = turtle.Screen() window.bgcolor("yellow") pen = turtle.Turtle() pen.shape("triangle") pen.color("red")    for number in range(0,petalNumber): draw_square(pen) pen.right(360/petalNumber) for i in range(0,4): pen.circle(20) pen.right(90)    pen.right(90) pen.forward(300) pen.right(90) draw_square(pen) pen.left(180) draw_square(pen) pen.left(270) pen.forward(200) window.exitonclick() #function for original art...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT