+ 2
When I tried to print (5²) the output was syntax error invalid character in identifier , why??
9 Réponses
+ 9
Because the particular programming language in which you wrote that ,don't understand that syntax . Just because it makes sense to you doesn't means it should make sense to computer as well . If you want to find square of a number than most languages provide a math library (google about it for the language you are using) or you can just multiply numbers like 5*5.
+ 5
Uhh, maybe print(5 ** 2)?
+ 4
Emma Chitembo
Nick Is right
We need to raise the power of number for than we need to type like this
print(5**2)
+ 3
Machines can not understand stand the normal mathamatics like
11%2 we get 1 likewise u has to 5**2
And high level language there is specific syntax : float pow(x,y)
Hope I discribed well...
+ 2
5**2 will be same as 5*5. Machine can't understand communication languages like we do
+ 1
Manvendra Yadav
Any answer is better than some people who love to add biased opinions and try to show off, yours is already considered good
+ 1
Can I ask a question?
Are you here to mess around or you're being serious
0
Daryna Ripych
Why are you doing a math operation on a string?