[Tutor] Exponential function

Alan Gauld alan.gauld at yahoo.co.uk
Tue Feb 14 18:01:10 EST 2017


On 14/02/17 12:03, Aaliyah Ebrahim wrote:

> For the function 1*10^x, is there a specific way of computing *10^x or will
> it just be the following :
> 
> 1*10**x

To compute it if you don't know x in advance then yes,
use something like

value = 10**x

But if you know the value in advance you can write it in
a more compact form as:

value = 1e5  # or 3e7 or whatever...

say(if x=5).

Experiment at the interactive prompt to see how it works.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list