+ 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?

17th Feb 2022, 12:49 PM
StefanFocht
StefanFocht - avatar
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.
17th Feb 2022, 12:56 PM
Simba
Simba - avatar
+ 3
Thanks a lot ā¤ļø
17th Feb 2022, 2:11 PM
StefanFocht
StefanFocht - avatar
+ 2
print(7**3)
17th Feb 2022, 11:46 PM
TAKOUMBE AndrƩ
TAKOUMBE AndrƩ - avatar
0
You need to use operator **, which raises the number to the power. num = 7 print(num**3)
17th Feb 2022, 1:58 PM
Yulia
0
šŸ˜‚šŸ¤­
17th Feb 2022, 2:10 PM
StefanFocht
StefanFocht - avatar
0
šŸ¤¦šŸ»ā€ā™‚ļø
17th Feb 2022, 2:10 PM
StefanFocht
StefanFocht - avatar
0
šŸ˜«šŸ˜±šŸ˜°šŸ˜“šŸ˜ÆšŸ„“šŸ¤¤šŸ™‚šŸ˜ƒ
18th Feb 2022, 11:27 PM
Asim Farheen ā­ā­šŸ¤ŗšŸ‘暟‘æ
Asim  Farheen ā­ā­šŸ¤ŗšŸ‘暟‘æ - avatar