what happens when you run the code? :-) i.e. there is nothing complicated as to what the output would be (multiplying float and int).
note that this example goes against PEP8 recommendations, so I would definitely mention it in an interview
Actually, was unable to figure out the approach to solve this 1e+20.
Got it, btw thanks:)
Simple things seem complicated to me;)
def exp10(value, exponent):
return value * 10 ** exponent
(Sep-11-2020, 11:32 AM)hannah Wrote: [ -> ]Actually, was unable to figure out the approach to solve this
Why? What didn't you understand about the code?
(Sep-11-2020, 11:32 AM)hannah Wrote: [ -> ]1e+20
there is nowhere
1e+20
in the question
Ah, I see - it's in the answers
Disclaimer: M a newbie in coding, trying to apply logic seems difficult sometimes.
But appreciate ya'll responding, will be back with more doubts whenever I come across.
There isn't really any "logic" in the code you posted, it's just a calculation. Assuming you know what the **
operator is and how functions work, you should be able to understand how it works (and if you don't understand those things, you'll likely need to study them more).