answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Bogdan [553]
1 year ago
6

This graphics program should draw a caterpillar. A caterpillar has NUM_CIRCLES circles. Use a for loop to draw the caterpillar,

centered vertically in the screen. Every other circle is a different color. When i is even, the circle should be red. When i is odd, the circle should be green. Remember that 0 is an even number. Be sure that the caterpillar is still drawn across the whole canvas even if the value of NUM_CIRCLES is changed. (PYTHON, CODEHS 4.6.6 Caterpillar.)
Computers and Technology
1 answer:
bearhunter [10]1 year ago
7 0

Answer:

radius = (get_width() / NUM_CIRCLES / 2)

x = radius

for i in range(NUM_CIRCLES):

   circ = Circle(radius)

   if i % 2 == 0:

       circ.set_color(Color.red)

   else:

       circ.set_color(Color.green)

   circ.set_position(x, get_height() / 2)

   add(circ)

   current_spot = x

   x = current_spot + (radius * 2)

Explanation:

You might be interested in
c++ You are given an array A representing heights of students. All the students are asked to stand in rows. The students arrive
Lilit [14]

The below code will help you to solve the given problem and you can execute and cross verify with sample input and output.

#include<stdio.h>

#include<string.h>

 int* uniqueValue(int input1,int input2[])

 {

   int left, current;

   static int arr[4] = {0};

   int i      = 0;

     for(i=0;i<input1;i++)

      {

         current = input2[i];

         left    = 0;

         if(current > 0)

         left    = arr[(current-1)];

      if(left == 0 && arr[current] == 0)

       {

       arr[current] = input1-current;

       }

       else

   {

       for(int j=(i+1);j<input1;j++)

       {

           if(arr[j] == 0)

           {

               left = arr[(j-1)];

               arr[j] = left - 1;

           }

       }

   }

}

return arr;

}

4 0
2 years ago
Type the correct answer in the box. Spell all words correctly.
kvasek [131]

Answer:

Presentations?

Explanation:

6 0
2 years ago
python Write a function that computes a future investment value at a given interest rate for a specified number of years. The fu
Svetlanka [38]

Answer:

def future_investment_value(investment, monthly_interest_rate, years):

  print("Years\tFuture Value")

  print("- - - - - - - - - - -")

  for i in range(1, years+1):

      future_value = investment * ((1 + monthly_interest_rate) ** (12 * i))

      print(i, "\t\t", format(future_value, ".2f"))

investment = float(input("Enter the invesment amount: "))

interest = float(input("Enter the annual interest rate: "))

year = int(input("Enter the year: "))

future_investment_value(investment, interest/1200, year)

Explanation:

Inside the function:

- In the for loop that iterates through the years, calculate the future value using the formula and print the results

Then:

- Ask the user for the investment, annual interest rate, and year

- Call the function with the given inputs

4 0
2 years ago
If you’d like to have multiple italicized words in your document, how would you change the font of each of these words?
Mariana [72]
You select the words and then format - italics
5 0
2 years ago
Read 2 more answers
A new company starts up but does not have a lot of revenue for the first year. Installing anti-virus software for all the compan
Feliz [49]

WAN domain which stands for Wide Area Network and consists of the Internet and semi-private lines. The <span>RISKS are: Service provider can have a major network outage, Server can receive a DOS or DDOS attack</span> and A FTP server can allow anonymously uploaded illegal software.





7 0
2 years ago
Other questions:
  • Clifford created a table using OpenOffice Writer and entered some information into the table. Later, he needed to add more rows
    15·2 answers
  • Carefully choosing from a set of alternatives to accomplish an objective is known as? A. Independence B. Decision making C. Netw
    9·2 answers
  • Which one of the following is the best example of an authorization control? (a)- Biometric device (b)- Digital certificate (c)-A
    11·1 answer
  • The function below takes two arguments, a dictionary called dog_dictionary and a list of dog names (strings) adopted_dog_names.
    8·1 answer
  • Consider the following network: proxy-cache On average there are 35 objects downloaded per second, and the average object size i
    14·1 answer
  • Information in​ folders, messages,​ memos, proposals,​ emails, graphics, electronic slide​ presentations, and even videos create
    7·1 answer
  • Longer speeches should be separated into the paragraphs of:
    9·1 answer
  • Consider the following class declaration: public class Square { private double sideLength; public double getArea() { return side
    13·1 answer
  • In the graph shown here, by what percentage are the number of people in computer occupations in general projected to increase?
    10·2 answers
  • Write a method so that the main() code below can be replaced by simpler code that calls method calcMilesTraveled(). Original mai
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!