Practice makes perfect


Anyone know why i can't print my strings into the console when the input should trigger them ?

int(raw_input("enter your number"))
n = raw_input 

def cube(n):
    cubed = (n)**3
    return cubed

def by_three(n):
    if (n) % 3 == 0: 
        print "n is divisible by 3"
        return cube(n) 
        print "n is not"
        return False


this code:

int(raw_input("enter your number"))
n = raw_input

should be one line, you should declare a variable (n), which holds the result of raw_input


hi, sorry im confused.

i tried n = int(raw_input("enter your number")) and a number of other variations of trying to declare n as the variable but i can't seem to find the right one.


works fine? If you actually want the function to execute, you should call it:

print by_three(n)

if you don't remember function calls, check here


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.