The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 2 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Problem 2 Create a Python function called product OfPowersOf2 which takes two arguments , both of which are non - negative integers . For purposes of this problem, let's call the first argument exp1 and the second argument exp2 . Your function should compute and return (not print) the product of all powers of 2 from 2 exp1 to 2 exp2 . H ere are some examples of how your function should behave:
>>> productOfPowersOf2(0,0)
1
>>> productOfPowersOf2(1,1)
2
>>> productOfPowersOf2(1,2)
8
>>> productOfPowersOf2(1,3)
64
Â
>>> productOfPowersOf2(1,4)
1024
Â
>>> productOfPowersOf2(1,5)
32768
>>> produ ctOfPowersOf2(2,4)
512
>>> productOfPowersOf2(3,12)
37778931862957161709568
>>>
-----------