Python novice Two Notes

Today is August 21, 2019, as a staff tackling poverty line, I will strive to do their own work, tackling poverty to the decisive moment, in home visits a day, collating information, increase public satisfaction,

Now we do not have holidays, and in theory is not granted leave, less time to learn, but I will stick to, learn a little bit every day.

With practice to know

Write a piece of code, first find out the logic of Chinese

1. First do the function of split

2. In the patchwork function (Chinese)

It is important

After the code is done, the first not to run, to go over the code logic, do not try to run.

If you get stuck writing code, not to copy someone else's, you can go to discuss what should this idea.

If you write well is due to practice, much will be written up.

Syntax cycle

break  中止当前循环
continue   本次循环,如果遇到continue,则不在往下走,而是回到while条件位置
else     不再满足while后的条件时触发 或条件=False

Integer

Python中的整型用int表示。
python2中:
   ·在32位机器上,整数的位数为32位,取值范围为-231~231-1,即-2147483648~2147483647
   ·在64位系统上,整数的位数为64位,取值范围为-263~263-1,         
    即-9223372036854775808~9223372036854775807
   ·超出长度之后就会变为long类型(长整型)。
python3中:
   ·只有int没有long,所有数字都是int类型。
在python2中
    使用除法时,只能保留整数位,如果想要保留小数位,可以先导入一个模块。
    1.from __future__ import division
    2.value=3/2
    3.print(value)
在py3中整型除法只能保留所有。

Boolean value

1. Only two values: True / False

2. Integer and String can be converted to a Boolean value.

Digital-to-boolean: 0 for all other True False

Boolean strings turn: an empty string "" is the other are all True False

Guess you like

Origin www.cnblogs.com/s-jy/p/11391156.html