首页 > 代码库 > PYTHON拼接显示循环和判断学习
PYTHON拼接显示循环和判断学习
拼接显示:
name = input("name:") age = int(input("age:"))#转义成整数 job = input("job:") salary = input("salary:") info = ‘‘‘ ----------in of %s-------- Name:%s age:%s job:%s salary:%s ‘‘‘ %(name,name,age,job,salary) %s 字符串 %d整数 info1 = ‘‘‘ ----------in of {_name}----------- Name:{_name} age:{_age} job:{_job} salary: {_salary} ‘‘‘.format(_name=name, _age=age, _job=job, _salary=salary) info3 = ‘‘‘ ----------in of {0}-------- Name:{0} age:{1} job:{2} salary:{3} ‘‘‘ .format(name,age,job,salary) print(info) print(info1) print(info3)
简单的循环,判断
guess_age_oldboy = 56 count = 0 while count <3: guess_age = int(input("guess age:")) if guess_age == guess_age_oldboy: print("YES,YOU GOT IT.") break elif guess_age > guess_age_oldboy: print("think 大了r..") else: print("think,小了") count +=1 if count == 3: countine_confirm = input("你还想玩吗?") if countine_confirm !=‘n‘: count=0 else: print("你太蠢了。。。。")
PYTHON拼接显示循环和判断学习
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。