Challenge: The Nearest Power of 2
Explore how to create a Python program that determines the power of 2 closest to a given positive number. Learn to apply loops, conditional statements, and decision-making to solve real-world problems involving numeric ranges and comparisons.
Task
Write a program that takes a positive number (num) and finds the power of 2
nearest to that number. The program stores the resulting value to pwr.
If there are two candidate values, display the smaller one. For example, and ...