gpt4 book ai didi

python - while循环测试

转载 作者:太空宇宙 更新时间:2023-11-04 09:59:42 25 4
gpt4 key购买 nike

<分区>

使用此 Python 代码我没有得到想要的结果。需要帮助。

当您输入满足条件的字符串时,while 循环应该停止。

代码:

x = input("Enter input: ")

while (int(x[3]) != 1 or int(x[3]) != 2):
print("The fourth character must be a 1 or 2")
x = input("Enter input again: ")

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com