Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 4. (5 points) Write a Python function called loops that takes no parameters and returns nothing. The function begins by asking the user to

image text in transcribed
image text in transcribed
Question 4. (5 points) Write a Python function called loops that takes no parameters and returns nothing. The function begins by asking the user to introduce two positive integers which you assign to two variables n and p respectively. The program (function) must then contain: - a. loop displaying and incrementing the value of n as long as it remains lower than that of p. - a 2nd other loop (independent of the 1st one) decrementing the value of p and displaying its value if it is odd. Loop as long as p is notzero. \# testing Question 4 loops() Please enter an integer n=0 Please enter second integer p=4 Values of n less than p are : 0 1 2 3 2 nd loop : Odd p-values are : 3 1 loops() Please enter an integer n=1 Please enter a second integer p=2 Values of n less than p are : 1 (nd loop : Odd p-values are : Odd 1 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is legalese? Give three examples of legalese.

Answered: 1 week ago