python-day6---运算符

#了解部分
#字符串+,*
#列表:+,*
# l1=[1,2,3]
# l2=[4,5]
#
# print(l1+l2)
# print(l1*3) #比较运算符
# num1=3
# num2=1 # print(num1 > num2)
# print(num1 < num2)
# print(num1 >= num2)
# print(num1 <= num2)
# print(num1 == num2)
# print(num1 != num2) #==判断的是值
#is判断的是id
'''
>>> num1=1234567890123456789
>>> num2=1234567890123456789
>>>
>>>
>>> id(num1),type(num1),num1
(41798792, <class 'int'>, 1234567890123456789)
>>> id(num2),type(num2),num2
(41798832, <class 'int'>, 1234567890123456789)
>>>
>>>
>>> num1 == num2
True
>>> num1 is num2
False
''' #其他类型的比较,注意:只能在同种类型之间进行比较(了解)
#字符串的比较是按照字符的位置依次比较
# s1='abc'
# s2='abC'
#
# print(s1 > s2)
#
# l1=['abc',2,'a','b']
# l2=['abd']
# print(l1 > l2)
# print(l2 > l1) #赋值运算
# x=10
# # x=x+1
# x+=1
# print(x)
#
# x/=3 #x=x/3
# print(x) # x=10
# x%=3 #x=x%3
# print(x) #逻辑与and
# age=input('您芳龄几何>>: ')
# age=int(age) # age=int(input('您芳龄几何>>: '))
# sex=input('您的性别是>>: ')
#
# print(age > 50 and sex == 'female') #逻辑或or
# age=int(input('您芳龄几何>>: '))
# sex=input('您的性别是>>: ')
#
# print(sex == 'female' or age > 50 ) # print(False and True or True)
# print((False and True) or True)
# print(False and (True or True))
# #
#
# print(False or False and True)
# print(False or (False and True))
# print(False or True and True)
#
#
#print(False or True and False or True)
#print(False or ((True and False) or True))
# print(1 > 10 or ( (2 > 1 and 1 < -1) or 4 > 3))
# print(False or True)

python-day6---运算符

python-day6---运算符

python-day6---运算符

python-day6---运算符

python-day6---运算符

python-day6---运算符

上一篇:JS验证框架(exValidation)


下一篇:HDU-1874 畅通工程续 (最短路径启蒙题)