
#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 ?
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 ?
- Najlepsze
- Wszystkie komentarze







^to operator XOR, do potęgowania użyj
**n % 3-->
m % 3