+ 1
Python (beginner)
#The provided code stores the value 7 in a variable, and outputs it. #Change the code to output the value of the variable raised to the power of 3. num = 7 del num num = 3 print(num) Could someone explain me what is the problem please?
7 Answers
+ 7
Raised to the power of 3 means, that variable is multiplied by 3 times itself.
In other words, 3 to the power of the variable.
+ 3
Thanks a lot ā¤ļø
+ 2
print(7**3)
0
You need to use operator **, which raises the number to the power.
num = 7
print(num**3)
0
šš¤
0
š¤¦š»āāļø
0
š«š±š°ššÆš„“š¤¤šš