[Tutor] First Time With Python - How To Calculate This Formula
Alan Gauld
alan.gauld at yahoo.co.uk
Sun Aug 9 19:40:13 EDT 2020
On 09/08/2020 20:06, eric grunfeld wrote:
> This is what I have without incorporating "to the 5th power"
> print(((1+2)*3)/4
>
> Unsure where to place "to the 5th power"
You have 2 options
1) use the pow() function
pow(2,5) -> 32
2) use the ** operator
2 ** 5 -> 32
So in your example:
print( (((1+2)*3)/4) ** 5 )
--
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