Practice makes perfect


#1


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) 
    
    else: 
        print "n is not"
        return False


#2

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


#4

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.


#5

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


#6

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