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. (转)解决nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed错误

    重新启动服务器,访问web服务发现无法浏览啦!登陆服务器之后进到nginx使用./nginx -s reload重新读取配置文件,发现报nginx: [error] open() "/usr ...

  2. DPDK安装依赖项合集 环境合集

    前言 在dpdk编译过程中,由于一些依赖项的限制,dpdk在纯净的系统上安装需要花一些功夫.本文总结了编译dpdk所需的依赖项,并归纳了安装合集,在安装过程上可以省下大量的搜索时间. 使用系统 ubu ...

  3. Linux安装部署

    Linux桌面发行版 UbuntuCentOSRed heat LinuxOracle Linux 一.系统安装 1.系统分区 若手动分区swap和根分区必须创建,推荐创建boot分区. /----- ...

  4. Spring 约束文件配置

    1.引入jar包 2.新建applicationContext.xml配置文件 位置随意,建议放在src目录下 新建的空xml文件,写入一对beans标签 3.打开Windows-->Prefe ...

  5. node创建服务器

    //引入核心模块 const http = require('http'); //创建服务器 http.createServer((req,res)=>{ }).listen(3000); // ...

  6. Bootstrap03

    一.表单(以下示例 * 代表class) 注意:a.使用表单的关键字form b.所有的提示词使用label包裹 c.所写内容按div分类,使得层次分明 1.基本表单+表单组合+内联表单 *=form ...

  7. 微信小程序——长按复制、一键复制

    wxml: 订单号:<text selectable='true' bindlongtap='copy' >{{OrderModel.OrderNo}}</text><b ...

  8. restframework序列化使用方法

    serializers.Serializer class Userinfoserializers(serializers.Serializer): username = serializers.Cha ...

  9. Dynamics CRM 常用的JS

    常用JS(一) Xrm.Page.context.getUserId():       //获取当前用户id Xrm.Page.context.getUserName():       //获取当前用 ...

  10. 20155234 2610-2017-2第九周《Java学习笔记》学习总结

    20155234第九周<Java学习笔记>学习总结 教材学习内容总结 数据库本身是个独立运行的应用程序 撰写应用程序是利用通信协议对数据库进行指令交换,以进行数据的增删查找 JDBC(Ja ...