[Tutor] small graphics question

nathan tech nathan-tech at hotmail.com
Tue Feb 9 20:01:03 EST 2021


Hi everyone!


Gosh! so sorry, I didn't realise my mail client had automatically 
switched over to the power to actually look superscript!


So, to clarify and answer questions:

1. I do, in fact, know how to work out powers and fractions in python, 
(though thanks for the tips!) :)

2. Yes, what I am actually asking is, how do I go about displaying 
formulae styled strings in something such as the print function.

that is to say, for instance, print("2/3") should come out as 2, with a 
line and the 3 under it.

Similarly 2 to the power of 3, should come out as 2 superscript 3.

Relatedly I need to make it variable, so the 2 superscript 3 could be 5 
superscript 293, which is why I'm not just finding the characters on 
google and substituting in.


I hope this helps!

Side note: I, myself, and blind and that may also contribute to why I 
didn't notice the mail client turning the characters properly and why my 
descriptions of fractions is a bit wonkey, sorry in advance :)


Nathan

On 09/02/2021 23:27, dn via Tutor wrote:
> 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
>


More information about the Tutor mailing list