1

I'm doing a maths revision program and I want to print out a question with y to the power of x(like xⁿ). I can't find a way to print it out as this form. Has anyone got any ideas?

This is how I want it to be displayed.

Dima Kozhevin
  • 3,602
  • 9
  • 39
  • 52
tegan.joy
  • 23
  • 3

1 Answers1

0

One possible option using ANSI escape sequences, it is not possible to control font size:

base = "x"
exponent = "n"

print('\033[1BFormula = %s\033[1A%s\033[1B etcetera'%(exponent, base))

In terminal you get:

 #            x
 #Formula = n   etcetera
iGian
  • 11,023
  • 3
  • 21
  • 36