day02五大运算符:逻辑运算符、成员运算符、算数、比较、赋值、

# -*- encoding: utf-8 -*-
# print('hello 中国')
# 变量
# print(10 + 20 + 3 + 15)
# print((10 + 20 + 3 + 15)*3/2)

# print((((10 + 20 + 3 + 15)*3/2)+5)/3)
'''
x = 10 + 20 + 3 + 15
y = x*3/2
z = (y + 5)/3
print(x)
print(y)
print(z)

i1 = 11 # True
2q = 12 # False 不能数字开头
_name = 'alex' # True
_ = 55 # True
__ = 'fdjska' # True
_ _ = 123 # False 有空格
q_1 = 55 # True
q34q = 11 #True
'''

# 变量的小高级
'''
age1 = 12
age2 = age1
age3 = age2
age2 = 18
print(age1,age2,age3)
# 12 18 12
# 12 18 18
# 常量
BIRTH_OF_CHINA = 1949
BIRTH_OF_CHINA = 1990
print(BIRTH_OF_CHINA)
'''

# 注释
# print('15') # 本行打印15结果。

# 基础数据类型

# ret = '太白金星'
# ret1 = 'My name is tbjx, i'm 18'
# ret1 = "My name is tbjx, i'm 18"
# print(ret1)

'''
msg = """今天我想写首小诗,
歌颂我的同桌,
你看他那乌黑的短发,
好像一只炸毛鸡。"""
print(msg)
r1 = 100
r2 = 'fsda'
r3 = alex
r4 = 'fdsafd'
r5 = '100'
'''
# + 字符串的拼接
'''
s1 = 'alex'
s2 = ' dsb'
s3 = s1 + s2
print(s3)
'''

# 字符串可以与数字相乘
'''
s1 = '坚强'
i1 = 8
print(s1*i1)
'''

# bool
"""
print(3 > 2)
print(3 > 5)

print('True')
print(False)
"""
# s1 = 'True'
# s2 = True
'''
s1 = '100'
s2 = 100
print(s1)
print(s2)
'''

# 验证这个内容是什么数据类型 type
'''
s1 = '100'
s2 = 100
print(s1,type(s1))
print(s2,type(s2))
'''

# 用户输入input
'''
name = input('请输入姓名;')
age = input('请输入年龄:')
# sex
# print(name, age,type(age))
print('我的姓名是 我的年龄是 我的性别是 ')
'''
#

'''
name = input('请输入姓名;')
age = input('请输入年龄:')
sex = input('请输入性别:')
msg = '我的姓名是'+name+'我的年龄是'+age+'我的性别是 '+sex
print(msg)

name = '太白金星'
n1 = name
n2 = 'name'
print(n1)
print(n2)
'''

# 第一种:if
'''
dream = input('长大了想做什么?')
if dream == '医生':
print('看病免费')
print(666)
a = 20
b = 3
print(a+ b)
'''
# 第二种
# 条件成立执行if的内容,条件不成立执行else
'''
age = int(input('请输入年龄:'))

if age > 18:
print('做你想做的事情')
else:
print('小屁孩儿')
print(666)


# 补充:str int 之间的转换
# str '00100' ---> int 字符串必须是合乎数字规定的内容
i1 = '100'
i2 = int(i1)
# print(type(i2))
# int ---- > str
i = 100
i3 = str(i)
print(type(i3))
'''

# 第三种:
'''
num = input('请输入你猜测的数字:')

if num == '6':
print('请你吃饭')

elif num == '3':
print('不用写作业了')

elif num == '1':
print('我请你大宝剑')
'''

# 第四种
'''
num = input('请输入你猜测的数字:')

if num == '6':
print('请你吃饭')

elif num == '3':
print('不用写作业了')

elif num == '1':
print('我请你大宝剑')

else:
print('真笨,都没猜中')

# print(666)

score = int(input("输入分数:"))

if score > 100:
print("我擦,最高分才100...")
elif score >= 80:
print("B")
elif score >= 90:
print("A")
elif score >= 60:
print("C")
elif score >= 40:
print("D")
else:
print("太笨了...E")
'''

# 第五种 嵌套if

code = input('请输入验证码:')
username = input('请输入用户名:')
password = input('请输入密码:')
if code == 'qwe3':
if username == 'alex' and password == '123':
print('登陆成功')
else:
print('用户名或者密码错误')

else:
print('验证码错误')
posted @ 2019-03-10 17:30  星空之主  阅读(373)  评论(0编辑  收藏  举报