[SOLVED] SOLVED:Juggle

14.99 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon juggle.zip (0.3 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
Rate this product

(While Loop – Juggling, 10pt) Write a function juggle(n) that calculates a sequence of numbers as follows: it starts with n. If n is even, it replaces n with the floor of n**0.5; if, on the other hand, n is odd, it replaces n with the floor of n**1.5. (Recall that the floor rounds down a number, it’s available as a function in the math library, or you can use int()). And it doesn’t do it just once, it keeps doing it until it hits n == 1, printing all the values of n it gets along the way. Here are two sample runs:

  • juggle.zip