What's wrong?


#1

Can someone help me


#2

please copy paste your code to the forum so i can run it

just looking at it, to check if a number is divisible by 3 we need to use the modulo operator, given the remainder equals zero if number is divisible by three

a function ends the moment a return keyword is reached, so return number is never reached given return cube(number) will end the function

boolean values (False and True have an uppercase first letter

the if condition doesn’t require parentheses


#3
def cube(number):
  result = number ** 3
  return result  
def by_three(number):
	if(number / 3 == True):
		return cube(number)
  	result2 = number / 3
   	return result2
	else:
    return false

#4

this two lines do nothing:

  	result2 = number / 3
   	return result2

you should remove them

how is this:

if(number / 3 == True):

going to help you determine that a number is divisible by 3?


#5

I tryng this:
def cube(number):
result = number ** 3
return result
def by_three(number):
if number / 3 != 0:
return cube(number)
else:
return false


#6

this line:

    return false

doesn’t have proper indent.

uhm… / is the division operator? Not the modulo operator. Use the modulo operator (%) to see if number is divisible by 3


#7

why not ???


#8

because after else you need additional indent:

	else:
            return false

#9

whats is this ???


#10

the indent is the amount of spaces or tabs, this should be known by now


#11

I know, but i tried all amounts of spaces and none worked


#12

Help from here


def cube(number):
  return number**3  
def by_three(number):
	if number % 3 != 0:

#13

if number is divisible by 3, the remainder is zero, so you should check if number % 3 equals zero

if so, return True else return False


#14

like this?

def cube(number):
  return number**3  
def by_three(number):
	if number % 3 == 0:
    return True
  else:
    return False

#15

no, like this:

def cube(number):
  return number**3  
def by_three(number):
  if number % 3 == 0:
    return True
  else:
    return False

your if had way much indent


#16

I back.
I tried this and:

by_three(3) returned True instead of 27


#17

oops, my mistake. You should read the cube(number) if number is divisible by three

i am human, i make mistakes, if i say something and the instructions say something else, follow the instructions


#18

how ???


#19

I did itttt
Thank you

def cube(number):
number3
return number
3
def by_three(number):
if cube(number) % 3 == 0:
return cube(number)
else:
return False


#20

no, cube(number) should be returned instead of True