[Tutor] small graphics question

boB Stepp robertvstepp at gmail.com
Tue Feb 9 18:12:49 EST 2021


On 21/02/09 10:36PM, nathan tech wrote:

>How do I write x to the power of y, in python/

"**" is the operator you seek as in your case
x**y

>Similarly, how do I produce fractions??

Are you just wanting to divide?  A normal float division uses "/" as its
operator.  If you are wanting to deal quite strictly with fractions, the
standard library has a module devoted to that.  The standard library also
has a module devoted to handling decimals, where you can monitor the level
of precision you need.  See the official docs on the main Python website.

-- 
Wishing you only the best,

boB Stepp


More information about the Tutor mailing list