Wpis z mikrobloga

#naukaprogramowania #pytanie #python #programowanie mam takie zadanie

Define a function called cube that takes a number and returns the cube of that number (which is that number raised to the third power).

Define a second function called bythree that takes one number as an argument. If that number is evenly divisible by 3, bythree should call cube on that number. Otherwise, by_three should return False

Taki napisałem kod

def cube(n):

return n^3

def bythree(m):

if n % 3 == 0:

return cube(m)

else:

return False

print bythree(3)

#osochodzi Gdzie popełniłem błąd ?
  • 8
@lukaszwasyl:



def
```**```
 
```_```
cube
```_```
(n):

   
```**```
return
```**```
 n**3
```**```
def
```**```
 
```_```
by_three
```_```
(n):

   
```**```
return
```**```
 
```**```
False
```**```
 
```**```
if
```**```
 n % 3 
```**```
else
```**```
 cube(n)

Pogrubianie działa w kodzie. Jeeeej! :)