Hello Python

来源:互联网 发布:西古德森数据 编辑:程序博客网 时间:2024/06/05 11:03
  1. My first Python demo

>>> movies=["a","b","c"]
>>> print(movies[0])
a
>>> print(movies[1])
b
>>> 
>>> print(movies)
['a', 'b', 'c']
>>> print(len(movies))
3
>>> 
  • Python 的变量标示符没有类型
  • Python定义变量为stirng类型后,可以tab查询可用的api
  • for或者while循环语句后加:后,再写逻辑代码
  • 定义的变量支持混合类型 movies=["a","b",1823,1234]
  • 变量可以直接定义,不需要声明




>>> count =0
>>> while count<len(movies)
SyntaxError: invalid syntax
>>> count =0
>>> while count<len(movies)
SyntaxError: invalid syntax
>>> while count<len(movies):
print(movies[count])
count++

SyntaxError: invalid syntax
>>> while count<len(movies):
print(movies[count])
count=count+1



a
b
c
d
原创粉丝点击