Question: Write a function in python called num _ halves that takes a positive number as input, and that uses a while - loop to count
Write a function in python called numhalves that takes a positive number as input, and that uses a whileloop to count and return the number of times we need to halve the number before it becomes smaller than
For example, starting with the number we get
:
:
:
:
:
:
:
:
That took halvings to get below so calling numhalves should return
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
