差了几篇博客,就先把今天学的写了~
主要听驴少吹了1个小时的PYTHON优越性,脚踢C语言,拳打JAVA,放眼于内,PY才是正义~
先打一段
print ('hello world')
压压惊
文件头
#!/usr/bin/env python
# -*- coding: utf-8 -*-
当行注释 #注释内容
多行注释 ""被注释内容""
变量的要求
变量名只能是 字母、数字或下划线的任意组合变量名的第一个字符不能是数字以下关键字不能声明为变量名['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield'] name1='apple' 变量赋值 + - * / 加减乘除 % 取除法的余数 ** x**y x的y次方 // 取除法商的整数部分 == 等于 != <> 不等于 >大于<小于 >= 大于等于 <=小于等于 and 与运算 or 或运算 not 非运算 编程还挺有意思~ n=3 while n>0: name = input('佛曰:') password = input('车牌号:') if name == 'apple' and password == '666': print("滴!学生卡") break else: n=n-1 print("年轻人你还有%d次机会" %(n)) if n==0: print("滚下车!")
