腾讯云
开发者社区
文档
建议反馈
控制台
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
登录/注册
精选内容/技术社群/优惠产品,
尽在小程序
立即前往
文章
问答
(9999+)
视频
沙龙
1
回答
在
使用
input
的
python
中
使用
if
else
语句
时
出错
python
、
if-statement
当我运行下面的代码
时
,我得到一个语法错误。问题出在哪里?我怎样才能纠正它?谢谢!m =
input
("enter number between -5 and +5: ")if m < 0: elifm > 0:
else
: print(m, " is equal to 0")
浏览 12
提问于2021-02-01
得票数 0
回答已采纳
2
回答
在
if/
else
中
使用
多个
input
语句
python
、
if-statement
、
input
、
logic
我正在尝试创建一个简单
的
程序,基于人们在下雨
时
应该采取什么交通方式上班,这取决于他们住得有多远:> 10km = "bus"我已经解决了第一个问题(至少我认为我已经解决了),但是我还不知道如何集成不同距离
的
不同if
语句
。因此,一旦一个人对“今天下雨了吗”
的
问题回答“否”,他们就必须输入一个整数来表示他们住得离工作
的
距离
浏览 0
提问于2016-02-26
得票数 1
1
回答
Python
中
的
Input
() IF
ELSE
Control
语句
python
、
pandas
、
numpy
、
if-statement
、
input
我有一个数据集,每当输入日期值
时
,特定
的
日期列都会移动。} df.assign(**{**s, 'mig2': datevalue}) df.assign(**{**s1, 'mig2': datevalue})mig2列
中
的
Date值被输入到输入()提示符<e
浏览 9
提问于2021-12-29
得票数 0
回答已采纳
9
回答
使用
if和
else
语句
时
出错
php
、
url
、
get
filter='Comedy'">Comedy</a></p> echo 'Action';
else
浏览 0
提问于2013-07-26
得票数 3
1
回答
使用
GoTo
语句
用于If/
Else
时
出错
excel
、
loops
、
goto
、
vba
只有
在
关联列中有数据
时
,我才
使用
以下代码来调整图表元素
的
外观:k = 3DimActiveChart.SeriesCollection.Add Source:=.Range(.Cells(3, k), .Cells(lr, k))
Else
Cells(3, k) = "-999") Then
浏览 1
提问于2017-04-25
得票数 0
回答已采纳
2
回答
python
中
的
raw_
input
不希望
使用
if-
else
语句
python
、
if-statement
、
input
我刚刚开始接触
Python
,但在用户输入操作方面遇到了一些麻烦。似乎当我尝试将一个raw_
input
与另一个字符串进行比较
时
,它总是为假?我已经确定大小写无关紧要,并且避免
使用
'
input
‘,因为它只接受数字。在对
Python
用户输入进行了一些googling搜索之后,我在这一点上感到非常困惑(是的,这是一个简单
的
温度转换程序)。我
使用
的
是
Python
v2.7.8 TL:DR,下面的代码总是导致'
浏览 1
提问于2014-10-17
得票数 1
2
回答
尝试
在
if
else
语句
中
使用
或
时
出错
sml
我正在尝试
使用
sml
在
if
else
语句
中编写函数cardcolor,如下所示 datatype suit = Clubs | Diamonds | Hearts | Spades; operator: bool
浏览 16
提问于2019-04-24
得票数 0
5
回答
尝试
使用
Except。我正在尝试实现评分,但除了打印作为输出之外,我一直
在
获取
python
、
try-catch
、
except
score =
input
('Enter score:') if score >= 0.9 and score < 1.0: if score >= 0.8 and score < 0.9:
else
:if score >= 0.7 and score < 0.8:
浏览 28
提问于2019-12-19
得票数 0
6
回答
在
java
中
应用if/
else
语句
时
出错
java
我
的
代码有问题,希望有人能看到我遗漏了什么。我
的
代码如下: boolean sailUp = false;
浏览 0
提问于2012-05-08
得票数 2
回答已采纳
1
回答
Python
raw_
input
问题
python
这是我
的
代码
input
= raw_
input
('Choose X or O') print
input
print 'Please choose an X or an O' player_
inpu
浏览 0
提问于2016-08-27
得票数 0
2
回答
ValueError:
使用
str.index
时
未找到子字符串
python
、
string
、
indexing
我是
python
的
初学者,下面是我正在尝试
的
代码print type(
input
_number) print "Not Accepted" print "Accepted&q
浏览 2
提问于2017-08-31
得票数 3
回答已采纳
1
回答
如何在
Python
中
检查
input
是否为数字?
python
、
if-statement
、
input
、
numbers
我有一个
Python
脚本,它将十进制数转换为二进制数,这显然
使用
了它们
的
输入。我尝试过if/
else
语句
,但我真的不知道该怎么做。我已经尝试过if decimal.isint():和if decimal.isalpha():,但当我输入字符串
时
,它们就会抛
出错
误。while True: print("Type a decimal numbe
浏览 0
提问于2013-11-20
得票数 2
回答已采纳
2
回答
input
与raw_
input
:
Python
交互式外壳应用?
python
、
shell
、
undefined
、
interactive
我正在研究这个问题
的
答案:def main(): s =
input
('> ') print我会得到NameError: name 'hello' is not defined 我应该如何监听文本,并根据结果调用不同
的
函数
浏览 3
提问于2013-04-06
得票数 4
回答已采纳
4
回答
这个程序一次又一次地给出答案,但我找不到方法来阻止它
python
、
python-requests
import random break print('you guessed too high')
else
浏览 4
提问于2020-08-30
得票数 1
4
回答
如何在这种情况下打印"Error“消息,因为"
else
”
语句
不起作用?
python
、
python-3.x
、
if-statement
、
int
编写读入三个整数a,b和c
的
程序。如果整数c等于1,则程序
在
输出上显示(打印)a+b
的
值;如果c等于2,则程序显示a-b
的
值;如果c等于3,则输出将是错误
的
值。最后,如果将值4赋给c,则程序显示a^2 + b_a
的
值。如果c包含其他值,则程序显示消息"Error“。a = int(
input
())c = int(
input
()) print(a + b)
浏览 56
提问于2018-09-27
得票数 0
回答已采纳
1
回答
Python
单元测试模拟输入注册错误输入
python
、
unit-testing
、
if-statement
、
mocking
、
nested
所以我刚开始进行单元测试,我试图弄清楚为什么模拟输入是以'yes'
的
形式读取,我不知道为什么当我将输入模拟为'no'
时
print("TEST2") print("TEST3") 没什么好疯狂
的
,挺直接
的
。这是我
的
测试代码。------
浏览 3
提问于2014-09-17
得票数 0
回答已采纳
7
回答
Python
:“预期缩进块”不知道如何修复
python
好
的
,我有我
的
程序,但是我得到了一个“期望
的
缩进块”,我不知道它在哪里,我相信我是对
的
,但是我很困惑。(Emily(1), James(2), Paco(3)") ptint(" ")talk == 3: print("Your level is", lvl, "you have", m
浏览 0
提问于2014-03-10
得票数 0
2
回答
未更新
的
总猜测计数
python
我是一个编程
的
初学者,我正在学习
python
,并决定做一个随机数猜测游戏。一切都进行得很好,但我想添加一个猜测计数器,我不确定为什么总数不会更新。def random_num(): total = 0对于total,输出为0,但这是不正确
的
。
浏览 0
提问于2019-04-05
得票数 0
4
回答
Python
,简单计算
python
a = int(
input
('Enter a number: ')) keep = True print('Thanks for playing.. goodbye')
else
: print('INVALID') a = int(
input</e
浏览 2
提问于2017-10-24
得票数 0
1
回答
通过过滤列
使用
if-
else
语句
时
出错
pandas
、
if-statement
我尝试创建一个名为brought_profit_to_company
的
新列,方法是过滤其他两列product_id并将其退回,但是它导致了一些错误:elif (df['product_id'] == '49.99'):
else
-------- TypeError
浏览 8
提问于2022-05-25
得票数 0
点击加载更多
扫码
添加站长 进交流群
领取专属
10元无门槛券
手把手带您无忧上云
相关
资讯
Python 中条件控制语句的使用介绍与说明
多版本 Python 在使用中的灵活切换
python yield在函数中起返回值中的使用
使用Bootstrap方法在Python中绘制带有置信带的ROC曲线
Python常见的错误处理方法
热门
标签
更多标签
活动推荐
运营活动
广告
关闭
领券