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

beginner python
beginner python The assignment is another exercise in using a particular language
feature, loops in Python. The intention is that you practice writing code

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_firstnamef 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 loop that counts from 3 down to 13, printing the count value each time in the loop. The output should be on one line and look like (notice the spacing and a period(.) at the end): 345678910111213. Call this loop within for while_loop_firstname(). 2. Write a loop that counts from 15 to 50 by fives, printing the count in each iteration but omitting numbers that are divisible by both 3 and 5 . The output should look like 20,25,35,40,50 Note that 15,30 and 45 are omitted as they are divisible by 3 also 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. Ask the user to input an integer parameter n. The loop should print out n times "I am on level k of the game." where k increases from 1 to n. So For example if input is 5 output should be as shown below: I am on level 1 of the game. I am on level 2 of the game. I am on level 3 of the game. I am on level 4 of the game. I am on level 5 of the game. 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 0 if input is even. If input is odd start with the even number 1 greater than the input and ending with 0 . For this you should use a while loop. The end. 3. Ask the user to input an integer parameter n. The loop should print out n times "I am on level k of the game," where k increases from 1 to n. So For example if input is 5 output should be as shown below: I am on level 1 of the game. I am on level 2 of the game. I am on level 3 of the game. 1 am on level 4 of the game. 1 am on level 5 of the game. 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 0 if input is even. If input is odd start with the even number 1 greater than the input and ending with 0 . 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 be 1086420 So for example if the input number passed is 11 (an odd number) the output should be 121086420 5. Ask the user to input an integer parameter. The loop should count up all the 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. The numbers should all appear on the same line. So for example if the number passed in using input is 7 the output should be 135 So for example if the number passed in using input is 8 the output should be 1357 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 "end = "to print out different variable counts in a single line inside a loop if they need to be printed on a single line

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!