ผลต่างระหว่างรุ่นของ "204111:Python missing details"
ไปยังการนำทาง
ไปยังการค้นหา
Jittat (คุย | มีส่วนร่วม) |
Jittat (คุย | มีส่วนร่วม) |
||
แถว 5: | แถว 5: | ||
When you want to use a variable, you have to give it a name. This is also true, again, with functions that you want to create. Providing good names helps people, including yourself, understand your programs faster and better. | When you want to use a variable, you have to give it a name. This is also true, again, with functions that you want to create. Providing good names helps people, including yourself, understand your programs faster and better. | ||
− | In Python, there are rules regarding how to name things. You can choose names like <tt>x</tt>, <tt>total</tt>, or even <tt>I_love_You_so_Much</tt>, but you can't have variables or functions with names like <tt>2things</tt>, <tt>x/y</tt>, or <tt>sum of numbers</tt>. | + | In Python, there are rules regarding how to name things. You can choose names like "<tt>x</tt>", "<tt>total</tt>", or even "<tt>I_love_You_so_Much</tt>", but you can't have variables or functions with names like "<tt>2things</tt>", "<tt>x/y</tt>", or "<tt>sum of numbers</tt>". |
== String formatting == | == String formatting == | ||
== Full operator precedence list == | == Full operator precedence list == |
รุ่นแก้ไขเมื่อ 02:57, 7 กรกฎาคม 2553
There are a number of topics left out from the teaching slides, because they are not central in programming concepts. However, these are details that are useful. Many of these are related to Python syntax. Some is related to string formatting.
Naming rules
When you want to use a variable, you have to give it a name. This is also true, again, with functions that you want to create. Providing good names helps people, including yourself, understand your programs faster and better.
In Python, there are rules regarding how to name things. You can choose names like "x", "total", or even "I_love_You_so_Much", but you can't have variables or functions with names like "2things", "x/y", or "sum of numbers".