python 加入语音功能的RW8模拟登录过程

复制代码
实现思路:
'''
1.输入用户名,输入密码  (有良好的交互﹣---->有提示,文字
2.确认输入
3.当用户名== ly 且密码=8866时,显示登录成功!

知识点:
1.输入语句﹣--- input
2.输出语句﹣--- print
3.input接受类型是字符串处理
4.重复
5.强制转换'''
python 复制代码
import pyttsx3

text4 = "登录成功"
text5 = "登录失败"
text1 = "请输入用户名"  # 用户名
print("请输入用户名")
pyttsx3.speak(text1)
a = input()
print(a)

text2 = "请输入密码"  # 密码
print("请输入密码")
pyttsx3.speak(text2)
b = input()
print(b)
print("确认请按1")
text3 = "请确认密码"
pyttsx3.speak(text3)
c = input()
if c == "1":
    if (a == "ly") and (b == "8866"):
        print("登陆成功")
        pyttsx3.speak(text4)
    else:
        print("登陆失败")
        pyttsx3.speak(text5)
else:
    print("登录失败")
    pyttsx3.speak(text5)
相关推荐
aqi002 小时前
15天学会AI应用开发(八)使用向量数据库实现RAG功能
人工智能·python·大模型·ai编程·ai应用
Csvn3 小时前
`functools.lru_cache` —— 一行代码搞定缓存加速
后端·python
金銀銅鐵19 小时前
[Python] 从《千字文》中随机挑选汉字
后端·python
cup111 天前
[技术复盘] Windows Python 打包实战:Nuitka 环境踩坑总结与 CI 自动化构建全指南
python·ai·环境变量·ci·nuitka·skill
aqi001 天前
15天学会AI应用开发(七)有了大模型为什么还要引入RAG
人工智能·python·大模型·ai编程·ai应用
金銀銅鐵1 天前
用 Python 实现 Take-Away 游戏
python·游戏
copyer_xyf1 天前
Agent 流程编排
后端·python·agent
copyer_xyf1 天前
Agent RAG
后端·python·agent