首页 技术 正文
技术 2022年11月7日
0 收藏 533 点赞 816 浏览 868 个字

偶尔经同事的介绍进入了金角大王的博客里,看到大王编写的文章都是关于python编程的,由于自己一直也是做软件测试方面的工作,也一直想往自动化测试方面发展,了解到利用python可以进行自动化测试操作,可以减少人工测试的繁锁操作。

读了python的基础篇了解了python的发展历史及python的基础知识点,就开始跟着课程去编写一些小脚本。

如下面是使用了for循环的语句:

 for i in range(10):
print("*******",i)
for j in range(10):
print(j)
if j > 5:
break

使用while循环写的语句:

 Tom_age = 30
count = 0
while count < 3:
guess_age = int(input("Please guess Tom age:"))
if guess_age == Tom_age:
print("Great,You got it!")
elif guess_age > Tom_age:
print("Sorry,Too big")
else:
print("Sorry,Too small")
count += 1
if count == 3:
continue_try = input("Do you want to try again? Enter Y go on,Enter N close.")
if continue_try!= 'N':
count = 0

还有使用while编写的猜年龄语句:

 age_of_oldboy = 56
count = 0
while count < 10:
#input前面加int表示将字符串转换成整数类型,如果不转换会报错。
guess_age = int(input("Guess age:"))
if guess_age == age_of_oldboy:
print("Yes,You got it.")
break
elif guess_age > age_of_oldboy:
print("Think smaller...")
else:
print("Think bigger!")
count += 1
else:
print("猜这么多次都不对,你这个笨蛋。")

努力学习,加油。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,085
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,560
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,409
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,182
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,819
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,902