A problem about practice makes perfect


#1

I just don't know where the wrong place was:
def cube(number_1):
return number_1 ** 3
def by_three(number_2):
if number_2 % 3 == 0:
print"number_2 is divisible by 3"
return cube(number_2)
else:
print"number_2 is not"
return False


#2

if number_2 % 3 == 0:

Don't use(FULLWIDTH COLON) instead use :


#3

Thank You! I noticed that.


#4

Not to grill you, or anything, but I wonder where this variable name came from...

number_1

and this,

number_2

If you are trying to make things more difficult for yourself, you are succeeding. Look for simplicity, meaning and purpose and not a way to catalog variables.

def cube(number):

That says it. The function is being handed a number and it will do something to that number. Simplicity, meaning and purpose.

def by_three(number):

Same rhetoric.

It is not necessary to invent variable names. They fall out of thin air as long as we follow the SMP model. Nothing arbitrary about it, though it is still arbitrary and subjective. Objective is the underlying current.


#5

I've made such a low mistake which I should say sorry. Later I will put forward some meaningful questions! Thank You!


#6

You are welcome.

I don't see any such mistakes, and have no issue with the question. Looking forward to your questions, should they arise. There is nobody here who needs to be impressed, so let them fly; and don't be judgemental of yourself. It only impedes your intuition.


#7

A post was split to a new topic: I cannot get my problem


#8

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