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)
相关推荐
时间的拾荒人几秒前
CMake 实战指南:从基础语法到静态库/动态库制作与链接
开发语言·c++·面试
天天被压力12 分钟前
【A股分钟级高频数据完全手册 #01】Pro版接口体系总览与REST鉴权:42篇地图与从0接入
java·人工智能·python
xyouyuweizhu15 分钟前
Java InetAddress 详解:从 IP 地址表示到主机名解析
java·开发语言·python
belldeep9 小时前
python:genesis-world, Genesis-Embodied-AI
人工智能·python·ai·genesis
布莱克6059 小时前
C/C++ 中变量的声明与定义:区别、联系与常见误区
c语言·开发语言·c++·声明·定义
LabVIEW开发9 小时前
LabVIEW 局部变量为何引发竞争条件?四种同步机制
开发语言·labview
ms365copilot9 小时前
Microsoft 365 Copilot跨工作资料整理
microsoft·copilot
benchmark_cc10 小时前
A 股、港股、美股如何建立统一的标的主数据格式?
开发语言·python·数据分析·pandas·量化交易·股票数据·quantdash
维克兜率天10 小时前
【维克】趋势型CTA:期货市场的“追涨杀跌“
人工智能·python
Zenova EdgeOS11 小时前
Go 工业边缘错误处理实战:用 errors 构建可追溯错误链
开发语言·数据库·golang