1answer.
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
Eddi Din [679]
4 years ago
12

6.12 Nested Increments Write a program for spiritual lumberjacks who want to show their appreciation for each tree they 'kill' b

y celebrating its years of life. Ask the lumberjack how many trees he wants to cut. Verify you got the number correctly by printing it to output. Write a loop that iterates over all the trees the lumberjack wants to cut down. Print the tree number to the screen to make sure your loop is working correctly. Query the lumber jack for how many rings are in this tree and print this number to make sure you got the correct number of rings. Write an inner loop that iterates over the years of the tree. Print each year to make sure you are iterating correctly and hitting each year that it lived. Change the necessary print statements and to match the correct formatting from the output examples.
Computers and Technology
1 answer:
Nina [5.8K]4 years ago
7 0

Answer:

trees_to_cut = int(input("How many trees do you wants to cut? "))

print(str(trees_to_cut) + " tree(s) will be cut.")

for i in range(trees_to_cut):

   print("Tree #" + str(i))

   

   rings = int(input("How many rings in tree " + str(i) + "? "))

   print("There are " + str(rings) + " ring(s) in this tree.")

   for j in range(rings):

       print("Celebrating tree #" + str(i) + "'s " + str(j+1) + ". birthday.")

Explanation:

*The code is in Python.

Ask the user to enter the number of trees to cut

Print this number

Create a for loop that iterates for each tree

Inside the loop:

Print the tree number. Ask the user to enter the number of rings. Print the number of rings. Create another for loop that iterates for each ring. Inside the inner loop, print the celebrating message for each birthday of the tree

You might be interested in
Whatis the restriction placed on the push operation for an array-based implementation of a stack?
tatuchka [14]

Answer:

if the number of elements in the array are equal to the size of the array then return -1.

Explanation:

We are implementing stack using array.Stack is a LIFO(Last In First Out) type data structure.Insertion and deletion is from one end only.

So while push operation or inserting elements in the stack using array we have to check that the capacity of array is not reached.If reached then no element can be inserted in the stack.If not then we can insert element in the stack.

8 0
3 years ago
1. Choose in each case that it affects which of the Information security requirements (confidentiality, integrity, availability)
just olya [345]

The  cases that it affects which of the Information security requirements is explained below.

<h3>What are the Information security violations of the above cases?</h3>

Someone has copied your credit card and CVV number has violated the confidentiality as this is to be known only by the owner for if the cvv is known by another person who is not the owner, it may lead to theft of the owners' funds/money.

If someone sends a message “Please come at 10 AM”, the receiver receives “Please come at 10.” and the person did miss the appointment due to the misinformation, it violates the availability. If one is not understanding a message, it is better to clarify so as to know if one will be available,

If the attacker has deleted the installed copy of the Microsoft Office application from your laptop is integrity/confidentiality. One who has integrity will not attack another's' system.

learn more about confidentiality from

brainly.com/question/863709

6 0
3 years ago
What objective behaves like a high level array
zavuch27 [327]

Answer:

C.Vector

Explanation:

Vector is a high level array used in C++.It has the capability of resizing itself when it gets full.it has many functions that increases it's functionality like size(),begin(),end(),erase(),clear(),push_back(),pop_back() and many more and we store any kind of data type in the vector.

syntax for declaring a vector:-

vector<data type> vector name.

8 0
3 years ago
How did the computer obtain its current ip address? how can you determine this
salantis [7]
Ip Adress is a one of a kind series of numbers isolated by periods that distinguishes every PC utilizing the Internet Protocol to convey over a system. These are the default setting when the PC can't discover a system and on the grounds that it is the Server's nearby IP.
4 0
4 years ago
What kind of output device would not be used to output images
saveliy_v [14]

Answer:

Speakers.

Explanation: Cause they only output sound, and are devices, further more they are not used to output images, like how could speakers output images using sound? They can't.

3 0
3 years ago
Other questions:
  • Given that it takes 0.08 ms to travel from one track to the next of a hard drive; that the arm is originally positioned at Track
    6·1 answer
  • Required
    12·1 answer
  • Most OEMs recommend that the engine oil be replaced and a new filter installed at which of the following mileage intervals ?
    7·1 answer
  • "The process was placed in a suspended state by an agent; either itself, a parent process, or the OS, for the purpose of prevent
    10·1 answer
  • Why is it important to use correct posture while typing
    7·1 answer
  • Ou are driving in stop-and-go traffic during the daytime, and someone in another vehicle tells you that your brake lights are no
    10·1 answer
  • Give two separate print statements: one will print your name, the other will print your major. Ensure that both will print on th
    15·1 answer
  • What does it mean to say RAM is volatile? *
    9·1 answer
  • Which command group on the Slide Master tab is used to add headers, footers, and other placeholders to the slide
    13·2 answers
  • What does a class do?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!