+ 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 Réponses
+ 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