python学习第三天 原

2019独角兽企业重金招聘Python工程师标准>>> #!/usr/bin/python

#filename:test3.py

a = 21

b = 10

c = 0

#part one : assignment operator

c = a + b

print ("Line 1 - Value if c is ",c)

c += a

print ("Line 2 - Value of c is ",c)

c *= a

print ("Line 3 - Value of c is ",c)

c /= a

print ("Line 4 - Value of c is ",c)

c = 2

c %= a

print ("Line 5 - Value of c is ",c)

c **=a

print ("Line 6 - Value of c is ",c)

c //=a

print ("Line 7 -Value of c is",c)

# part two : bit operator

a = 60

b = 13

c = 0

c = a & b

print ("Line 1 - Value of c is ",c)

c = a | b

print ("Line 2 - Value of c is ",c)

c = a ^ b

print ("Line 3 - Value of c is ",c)

c = ~a

print ("Line 4 - Value of c is ",c)

c = a << 2

print ("Line 5 - Value of c is ",c)

c = a >> 2

print (" Line 6 - Value of c is ",c)

#part three : logical operator

a = 10

b = 20

c = 0

if( a and b ):

print ("Line 1 - a and b are true ")

else :

print ("Line 1 - ether a or b is not true ")

if( a or b ):

print ("Line 2 - at least one of them is true ")

else :

print ("Line 2 - Neither a nor b is true")

a = 0

if( a and b ):

print ("Line 3 - a and b are true")

else:

print ("Line 3 - either a or b is not true")

if not( a and b):

print ("Line 5 - either a or b is not true")

else :

print ("Line 5 - a and b are true")

# part four

a = 20

b = 20

if( a is b):

print ("Line 1 - a and b have same identity")

else:

print ("Line 1 - a and b do not have same identity")

if( id(a) == id(b)):

print ("Line 2 - a and b have same identity")

else:

print ("Line 2 - a and b do not have same identity")

b = 30

if( a is b):

print ("Line 4 - a and b do not have  same identity")

else:

print ("Line 4 - a and b do not have  same identity")

if(a is not b ):

print ("Line 4 - a and b do not have same identity")

else:

print("Line 4 - a and b have the same identity")

#PART FIVE

a = 20

b = 10

c = 15

d = 5

e = 0

e = ( a + b )*c/d

print ("value of (a + b) * c / d is ",e)

e = ((a + b ) * c)/d

print ("value of ((a+b)*c)/d is ",e)

e = ( a + b) * (c / d)

print ("value of ( a + b) * (c/d) is ",e)

e = a + (b * c) /d

print ("Value of a + ( b * c)/d is ",e)

#PART SIX

num = 5

if num == 3:

print ("boss")

elif num == 2:

print ("user")

elif num ==1:

print ("worker")

elif num < 0 :

print ("error")

else:

num = 9

if num >= 0 and num <= 10:

print ("hello")

else:

print ("undefine")

if(num >=0 and num <= 5) or (num >= 10 and num <= 15):

print ("hello")

else:

print ("undefine")

“Python机器（深度）学习算法原理与案例实现”培训班通知

“Python机器（深度）学习算法原理与案例实现”培训班通知 各科研院所及企业单位： 随着人工智能与数据科学的发展，在商业、经济及其他领域中基于数据和分析去发现问题并作出科学客观的决策越...

2018/08/25
1
0
“Python机器（深度）学习算法原理与案例实现”培训班通知

“Python机器（深度）学习算法原理与案例实现”培训班通知 各科研院所及企业单位： 随着人工智能与数据科学的发展，在商业、经济及其他领域中基于数据和分析去发现问题并作出科学客观的决策越...

2018/08/25
0
0

【新智元导读】在星期四的一份名为“权力转移”的邮件列表帖子中，Python之父Guido van Rossum写道：“现在PEP 572已经完成，我不再想为一个PEP这么努力争取，而且还发现有这么多人鄙视我的决...

2018/07/16
0
0

“我累了，需要很长时间的休息。” 2018 年 7 月，在 PEP 572（Python 改进提案） 被接受后的第三天，由于仍然不断面对着别人的质疑，反馈意见不断袭来，让这位一手缔造新的编程语言帝国的图...

AI科技大本营
03/08
0
0

随着机器学习的兴起，Python 逐步成为了「最受欢迎」的语言。它简单易用、逻辑明确并拥有海量的扩展包，因此其不仅成为机器学习与数据科学的首选语言，同时在网页、数据爬取可科学研究等...

2018/08/22
0
0

FPGA 设备 USB Platform Cable USB

lsusbFuture Technology Devices International, Ltd FT232H Single HS USB-UART/FIFO IC

MtrS

4
0
lua web快速开发指南(6) - Cache、DB介绍

"数据库"与"缓存"的基本概念 数据库与缓存是服务端开发人员的必学知识点. 数据库 "数据库"是一种信息记录、存取的虚拟标记地点的集合统称. 比如现实生活中, 我们经常会用到文件柜、书桌等等数...

6
0
Oracle分页查询语句的写法

Oracle分页查询语句的写法 Oracle分页查询语句使我们最常用的语句之一，下面就为您介绍的Oracle分页查询语句的用法，Oracle分页查询语句基本上可以按本文给出的格式来进行套用。 　　Oracle分...

5
0
java并发图谱

1527

2
0
Mybatis之拦截器Interceptor

2
0 