当前位置: 首页 > news >正文

linux网站入口互动营销是什么

linux网站入口,互动营销是什么,坪山网站建设多少钱,手机如何创建个人网站1. 在猜年龄的基础上编写登录、注册方法#xff0c;并且把猜年龄游戏分函数处理#xff0c;如 2. 登录函数 3. 注册函数 4. 猜年龄函数 5. 选择奖品函数 代码如下 import json real_age 18 prize_list [好迪洗发水, 绿箭侠, 小猪佩奇, 布娃娃, 再来一次!] import random us…1. 在猜年龄的基础上编写登录、注册方法并且把猜年龄游戏分函数处理如 2. 登录函数 3. 注册函数 4. 猜年龄函数 5. 选择奖品函数 代码如下 import json real_age 18 prize_list [好迪洗发水, 绿箭侠, 小猪佩奇, 布娃娃, 再来一次!] import random user_prize_dict {} import os def register(): while True: username input(输入用户名(q退出):).strip().lower() if usernameq:break password input(请输入密码).strip() re_password input(请再次确认密码:).strip() if not password re_password: print(密码不一致请重输) continue user_dic {name: username, password: password} json_user_dic json.dumps(user_dic) with open(f{username}.txt, w, encodingutf-8)as f: f.write(json_user_dic) f.flush() print(注册成功) break def login(): count 0 while True: if count 3: print(错误输入次数过多) break username input(请输入用户名:).strip() if not os.path.exists(username .txt): print(该用户不存在) continue password input(请输入密码).strip() with open(f{username}.txt, r, encodingutf-8) as f: user_json_dic f.read() user_dic json.loads(user_json_dic) if username user_dic[name] and password user_dic[password]: print(登录成功) guess_age() break else: print(用户名或密码错误) count 1 def guess_age(): count 0 print(现在进入猜年龄游戏环节.......\n) while True: count 1 if count 4: print(抱歉你三次都猜错了) again_guess_age input(请问是否要继续猜3次y继续n退出:).strip().lower() if again_guess_age y: count 0 continue break age input(请输入你的年龄).strip() if not age.isdigit(): print(请输入纯数字) continue age int(age) if age real_age: print(猜大了) elif age real_age: print(猜小了) else: print(恭喜你猜对了\n) choice_prize() break def choice_prize(): count 1 print(进入抽奖环节.....,您共有两次机会\n 奖品如下) while True: for index, prize in enumerate(prize_list, 1): print(index, prize) choice input(请按下按钮y随机选择奖品:).strip().lower() if not choice y: print(非法输入) continue prize_choice random.randint(1, 15) if prize_choice in [6, 7, 8]: prize_choice 4 elif prize_choice in [9, 10, 11, 12, 13, 14, 15]: prize_choice 5 prize prize_list[prize_choice - 1] if prize in user_prize_dict: user_prize_dict[prize] 1 else: user_prize_dict[prize] 1 print(f本次获得奖品为{prize},您还有{2-count}次机会\n) if count 2: if user_prize_dict.get(再来一次!): user_prize_dict.pop(再来一次!) print(f总共获得的奖品为{user_prize_dict}) break count 1 user_func_dic { 1: register, 2: login, } while True: print( 先注册登陆后才能玩猜年龄游戏哦 1. 注册 2. 登录) choice input(请选择功能编号(q退出):).strip().lower() if choice q : break if not choice in user_func_dic: print(错误输入) continue user_func_dic.get(choice)() 以上就是本文的全部内容希望对大家的学习有所帮助也希望大家多多支持我们。 本文标题: Python实现猜年龄游戏代码实例 本文地址: http://www.cppcns.com/jiaoben/python/303789.html
http://www.pierceye.com/news/885825/

相关文章:

  • 自建网站服务器备案免费做易拉宝网站
  • 经典手机网站家政公司网站模板
  • 外贸做的亚马逊网站是哪个好产品怎样推广有效
  • 网站后台数据库备份怎么做怎样在阿里做网站
  • 后台网站手机版视频怎么做安阳百姓网
  • 设计公司网站公司详情域名解析网站登录
  • 优秀学校网站设计可以免费下源码的网站
  • 榆林高端网站建设xampp使用教程 wordpress
  • 站长工具搜一搜找做网站的
  • 建一个域名网站要多少钱南京哪里有做网站的
  • 网站群的建设网站建设自助建站制作
  • 怎么做网站程序标书制作教程全过程
  • 学网站建设前景印度做杂质的网站
  • 网站的建设意义盐城网站建设找哪家好
  • 赤峰市网站建设年轻人免费在线看视频
  • 使用word做网站网络广告的特点有哪些?
  • 网站系统参数设置定制网站的制作流程
  • 做家教网站公司品牌vi设计升级
  • 唯品会网站建设建议浙江网站建设价格费用
  • 网站建设购买深圳有做网站的公司有哪些
  • 网站预算表怎么做网站域名续费怎么续费
  • 宁波建设网站公众号关注编辑网站教程
  • 怎样自己做刷赞网站开发软件需要多少成本
  • 为什么网站之有首页被收录广西两学一做网站
  • 制作网站需要的软件怎么向google提交网站
  • 济南网站的建设公司网站建设征求意见表
  • 小学校园网站建设简介打开网站弹出一张图片 怎么做
  • 做外贸没有网站需要注意什么条件做简历模板的网站都有哪些
  • 铜陵保障性住房和城乡建设网站舞钢市城乡建设局网站
  • 企业网站总承包建设模式关键步骤凡科论文送审平台