Question: The assignment is another exercise in using a particular language feature, loops in Python.The intention is that you practice writing code with the small tasks.

The assignment is another exercise in using a particular language feature, loops in Python.The intention is that you practice writing code with the small tasks. If you copy from other people you are only depriving yourself of an education. To learn, you have to think it through, yourself. Finding a solution online and copying it is easy, but leaves you facing the problem of learning what you were supposed to learn, in the context of a much harder problem the next time.To practice writing loops, create a method called for_while_loop_firstname instead of main. Write The following loops within the for_while_loop_firstname() of the same .py program and not as functions. All the loops have to be written using a for loop or a while loop. Turn in this assignment with comments and a header as a zip (or rar) folder as usual that contains only the source code.Write main program called for_while_loop_firstname instead of main which should include the following five loops.1. Write a while loop that counts from -21 down to -30, printing the count value each time in the loop. The output should be on two lines as shown below with first 5 numbers on the first line and the next 5 numbers on the second line (notice the spacing and a period(.) at the end): Use a variable count_firstname to count the numbers and once this count reaches 5, remaining numbers are printed on the next line.-21-22-23-24-25-26-27-28-29-30.Call this loop within for_while_loop_firstname().2. Write a for loop that prints all multiples of 9 between 1 and 100, printing the count in each iteration but omitting numbers that are divisible 5. Use continue to omit the numbers divisible by 5. The output should look like9,18,27,36,54,63,72,81,99Note that 45 and 90 are omitted as they are divisible by 5.Notice the commas in between. Notice that there is no comma at the beginning or end. That means that you must do something special either at the beginning or at the end.3. Write a loop to validate the input entered. Ask the user to enter an integer greater than or equal to 2101 and less than 3102. Loop should be repeated as long as an invalid number is entered. If a valid input is entered, should print Good Job, Firstname. Please use your first name.So for example if the user enters 2000, loop should say Invalid Input. Please enter a number between 2101 and 3101 both numbers included.If user enters 3000, program should say Good Job, Firstname.4. Ask the user to input an integer parameter The loop should count down only the even numbers, starting with the input number and ending with the negative of the input number if input is even. If input is odd start with the even number 1 greater than the input and ending with the even number 1 greater than the negative of the input number . For this you should use a while loop. The numbers should all appear on the same line.So for example if the input number passed is 10(an even number) the output should be1086420-2-4-6-8-10So for example if the input number passed is 11(an odd number) the output should be121086420-2-4-6-8-105. Ask the user to input an integer parameter. The loop should find the sum of all the positive odd numbers below the number, starting with the number 1 and up to the number that was passed as the input parameter. For this you should use a for loop. So for example if the number passed in using input is 7 the output should beSum of all odd numbers below 7 is 9.( This will be 1+3+5. You do not need to show the calculation.)So for example if the number passed in using input is 8 the output should beSum of all odd numbers below 8 is 16.( This will be 1+3+5+7. You do not need to show the calculation.) Name the file also as for_while_loop_firstname.py with the loops function, do all these loops within the for_while_loop_firstname function. Do not submit 5 different programs. Use your first name wherever first name is mentioned.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!