[Tutor] small graphics question

dn PyTutor at DancesWithMice.info
Tue Feb 9 18:27:47 EST 2021


On 10/02/2021 11.36, nathan tech wrote:
...

> How do I write x to the power of y, in python/
> 
> Not 5^2 for 5 squared, but 5 superscript 2? or 5 superscript x where x
> is any number?
> 
> Similarly, how do I produce fractions??
> 
> I asked here in the end because I figure for wx python it is just
> tracking down that character sequence and then writing it on screen
> (which I can do!)


Interestingly, I started-out puzzling your question because Thunderbird
(email client) displayed the "Not 5..." with the power as a superscript.
It was only when I hit Reply that I saw the text as "Not 5 circumflex
2". Can only guess what you will see (above).

Please clarify "write" and "produce". Do you want to know:
- how to compute numbers raised to some power, and
- how to compute values expressed as numerator and denominator (fractions)
or
- how to display formulae (including powers and/or fractions) as text in
a convenient manner

-- 
Regards,
=dn


More information about the Tutor mailing list