标签:最大 ring 注释 变量 括号 int style 保留字 pre
一.python第一个程序
print("hello world")
二.变量的命名规则
  1. 字母数字下划线组成
  2. 不能以数字开头,不能含有特殊字符和空格
  3. 不能以保留字命名
  4. 不能以中文命名
  5. 定义的变量名应该有意义
  6. 驼峰式命、 下划线分割单词
  7. 变量名区分大小写
三.if条件判断
if  a<b:
    print("Yes")
else:
    print("No")
if a>b:
    print("a>b")
elif a==b:
    print("a=b") 
    
else:
    print("a<b")
python没有大括号的用法,需要进行缩进。
四.注释方法
# 单行注释 ‘‘‘多行注释‘‘‘ """ 多行注释 """
五.python的输入
input("请输入:")
六.python的输出
print("abc"+"def")
字符串的拼接使用“+”,int型与string型不能拼接,需要强制类型转换。
七.选择最大值的程序
num1=int(input("num1:"))
num2=int(input("num2:"))
num3=int(input("num3:"))
max_num=0
if num1>num2:
    max_num=num1
else:
    max_num=num2
if num3>max_num:
    max_num=num3
print("最大值为:"max_num)
标签:最大 ring 注释 变量 括号 int style 保留字 pre
原文地址:https://www.cnblogs.com/sfencs-hcy/p/9501205.html