0
Printing a squared number
I was wondering how to print a squared number, such as x^2, in proper form. Currently I have print = ("x**2"). Although I understand this is x squared I was wondering if there is a way to make the output more user friendly with a correct looking notation?
4 Answers
+ 10
If you want to print an square of a number
Use print method
Like this đ
x= int(input())
print(x**2)
+ 7
If you want to find value of 2x² then multiply square of x with 2
0
Thank you but I'm currently creating a code for the quad formula. After prompting the user for the values of a, b, and c, I was hoping to print out whatever the equation they have is. For example if a is 2 I want to be able to
print = (a + ("x squared"))
with the output being 2x^2
Im not sure if it's even possible to print it correctly as x^2
0
Thank you for the help Piyush! I was looking for how to print out "2x²" as "2x²" (not as x**2 or x^2) and realized I could just add the "²" as part of the string.