Does my variable name need to match the math I’m doing?

Question

Most of the variable names in these exercises match the math being done in the value they’re assigned.

Answer

Your variable can be named anything you like! You could name a variable addition and then set its value as the addition of two numbers, or you could just as easily name it twoNumbers.

However, it’s definitely helpful to anyone reading your code (including you) if you name your variables in a way that is unambiguous and descriptive. For example, naming a variable x may be short and sweet, but it tells me absolutely nothing about the value it holds or what it’s meant for. If we have a variable named degrees_celsius, it seems likely that it would hold some number that is the temperature in celsius. Much better!

10 Likes

ben katsayısı = 40/8 yaptım ancak çalışmadı ve karşıma şu çıktı Adlı bir değişken oluşturdunuz product mu?
ne yapmalıyım?

ben katsayısı = 40/8 yaptım ancak çalışmadı ve karşıma şu çıktı Adlı bir değişken oluşturdunuz product mu?
ne yapmalıyım?

You first have to speak in English and have a minimum of common sense. Then what you have to do is assign a variable called product and put

Product = 40/15

Then you have to use the command print() to tell the interpreter that it should execute the result of tha variable; so you have to type in:

print(product)

With all this said I would lastly make you another recommendation; see Pulp fiction scene in original language where there is a guy interrogated in a chair. That’s the best advice I can make you.

Happy coding :stuck_out_tongue: