2018/05/10

[来源:菜鸟教程](http://www.runoob.com/python3/python3-examples.html)

#No.1
# 二次方程式 ax**2 + bx + c = 0
# a、b、c 用户提供 # 导入 cmath(复杂数学运算) 模块
'''
cmath.sqrt(x)
Return the square root of x.
'''
import cmath a = float(input('please input a:'))
b = float(input('please input b:'))
c = float(input('please input c:')) d = (b**2) - (4*a*c) sol1 = (-b-cmath.sqrt(d))/(2*a)
sol2 = (-b+cmath.sqrt(d))/(2*a) print('result is {0} and {1}'.format(sol1,sol2))
result:

d:\fly\HTML
λ python test.py
please input a:4
please input b:5
please input c:6
result is (-0.625-1.0532687216470449j) and (-0.625+1.0532687216470449j)
#No.2
'''
random.randint(a, b)
Return a random integer N such that a <= N <= b. Alias for randrange(a, b+1).
''' import random
print(random.randint(0 , 9))
print(random.randrange(0 , 9))
result:

d:\fly\HTML
λ python test.py
0
3
#No.3
num = float(input('please input a num:'))
if num > 0:
print('positive number')
elif num == 0:
print('zero')
else:
print('negative number') or num = float(input('please input a num:'))
if num >=0:
if num == 0:
print('zero')
else:
print('positive number')
else:
print('negative number')
result:
d:\fly\HTML
λ python test.py
please input a num:8
positive number d:\fly\HTML
λ python test.py
please input a num:0
zero d:\fly\HTML
λ python test.py
please input a num:-9
negative number

【坚持】Selenium+Python学习之从读懂代码开始 DAY2的更多相关文章

  1. 【坚持】Selenium+Python学习之从读懂代码开始 DAY1

    学习Selenium+Python已经好几个月了,但越学发现不懂的东西越多. 感觉最大的问题还是在于基础不扎实,决定从头开始,每天坚持读代码,写代码. 相信量变一定能到质变!!! 2018/05/09 ...

  2. 【坚持】Selenium+Python学习之从读懂代码开始 DAY7

    2018/05/25 EC [EC](https://github.com/easonhan007/webdriver_guide/blob/master/34/expected_conditions ...

  3. 【坚持】Selenium+Python学习之从读懂代码开始 DAY6

    2018/05/23 Python内置的@property装饰器 [@property](https://www.programiz.com/python-programming/property) ...

  4. 【坚持】Selenium+Python学习之从读懂代码开始 DAY5

    2018/05/22 函数作为返回值 [来源:廖雪峰的官方网站](https://www.liaoxuefeng.com/) #No.1 def lazy_sum(*args): def sum(): ...

  5. 【坚持】Selenium+Python学习之从读懂代码开始 DAY3

    2018/05/15 [来源:菜鸟教程](http://www.runoob.com/python3/python3-examples.html) #No.1 list = [1, 2, 3, 4] ...

  6. 【坚持】Selenium+Python学习之从读懂代码开始 DAY4

    2018/05/21 [生成器详解:廖雪峰的官方网站](https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d ...

  7. 软件测试自动化…python学习到什么程度?代码好不好学!

    软件测试自动化…python学习到什么程度?代码好不好学! 如下:

  8. Gradle学习系列之三——读懂Gradle语法

    在本系列的上篇文章中,我们讲到了创建Task的多种方法,在本篇文章中,我们将学习如何读懂Gradle. 请通过以下方式下载本系列文章的Github示例代码: git clone https://git ...

  9. selenium+python学习总结

    学习了一个月的selenium+python,终于学有所成,下面以一个简单的项目来总结学习所得. 1.         项目结构 在项目结构中,大家要注意到:每一个源文件夹中都要有一个__init__ ...

随机推荐

  1. 生产者-消费者模型-线程安全队列Queue

    #python3 #product new data into the queue #comsume data from the queue from queue import Queue impor ...

  2. vlc源码分析(四) 调用libts接收TS流

    代码分析前,先要了解TS流基本概念:TS流之基本概念. VLC解析TS流是通过libts库来分离的,libts库使用libdvbpsi库来解TS表.VLC使用模块加载机制来加载libts库,具体调用的 ...

  3. 双显示器N卡安装ubuntu驱动以及解决办法

    之前我是打算在win下面结合虚拟机开发前后端,今天仔细想了一下,不是很靠谱,后端调试太困难了.可能的方案就是Netbeans远程开发的方式,以前我试过,调试起来也是非常的麻烦.于是果断下载个ubunt ...

  4. SSAS 度量值中的distinct count局聚合方式会数为null的值

    我们来看一个例子 Analysis Services: For Distinct Count measure NULL = 0 If you are to look at the table of v ...

  5. ArcMap中用python的split方法提取字段的值

    提取PROPERTY_L字段空格分隔符前面的地址编号 提取前:5105 ABERDEEN LANE 提取后:5105 提取的表达式:!PROPERTY_L!.split(" ")[ ...

  6. CSS网页布局:盒子模型

    一.盒子模型 标准盒子模型(W3C盒子) 不论是标准盒模型还是IE盒子模型,都有content.padding.border.margin四个部分组成,但从上图也可以看出W3C盒子和IE盒子主要区别在 ...

  7. 基于oracle数据库存储过程的创建及调用

    1.PLSQL编程 1.1概念和目的 PL/SQL(Procedure Language/SQL) PLSQL是Oracle对sql语言的过程化扩展 指在SQL命令语言中增加了过程处理语句(如分支.循 ...

  8. 使用属性Props完成一张卡片

    一:我们先安装bootstrap,为了使我们的样式好看些 cnpm  install bootstrap  --save 二:我们在index.js中引入bootstap Import ‘bootst ...

  9. cookie、localstorage、sessionstorage区别

      localstorage sessionsorage cookie 大小 浏览器不能保存超过300个cookie,单个服务器不能超过20个,每个cookie不能超过4k 可以达到5M 可以达到5M ...

  10. urllib库使用方法 3 get html

    import urllib.requestimport urllib.parse #https://www.baidu.com/s?ie=UTF-8&wd=中国#将上面的中国部分内容,可以动态 ...