我需要一些帮助 [英] i need some help

查看:63
本文介绍了我需要一些帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是python语言的初学者,我有以下问题:


i我试图在某些限制下定义一些东西,比方说X,我不知道该怎么做那。


基本上我想做以下事项:如果X小于200且大于100,则继续,否则停止。


可以为某人提供某种起点。我知道我必须做一个for循环,但不确定如何去做。


提前感谢

解决方案

< blockquote>


我是python语言的初学者,我有以下问题:


i我试图定义一些东西,比方说X,在一定限度内,我不知道该怎么做。


基本上我想做以下事项:如果X小于200且大于100,则继续,否则停止。


可以为某人提供某种起点。我知道我必须做一个for循环,但不确定如何去做。


提前感谢



你不需要for循环。使用 if 语句测试条件。如果满足条件,做一些事情。否则,做一些其他事情。

展开 | 选择 | Wrap | 行号



你不需要for循环。使用 if 语句测试条件。如果满足条件,做一些事情。否则,做一些其他事情。

展开 | 选择 | Wrap | 行号



抱歉,我应该提到整件事,因为我仍然不确定。

我这里的x实际上是一个值列表。我有2个值对应的id列表,我试图使用这两个列表定义参数。我只是不知道正确的符号和编写代码:

i我正在尝试以下但没有成功:


>>> ; x =字段[1] - 我的列表

>>> y = filelds [2] - 第二个列表

>>>如果100< = x< = 200

>>>>>继续

>>>>>>>如果5< = y< = 8

>>>>>>>> print id(打印具有已定义参数的id)


再次感谢您的帮助



您将需要一个for毕竟循环。我认为字段是一个列表列表。也许像下面这样的东西?

展开 | 选择 | Wrap | 行号


I am a beginner in python language and I have the following question:

i am trying to define something, let say X, under certain limits and I am not sure how to do that.

basically i want to do the following: if X is less than 200 and greater than 100, then continue, else stop.

can someone provide some kind of starting point. i know i have to do a for loop, but not exactly sure how to go about it.

thanks in advance

解决方案

I am a beginner in python language and I have the following question:

i am trying to define something, let say X, under certain limits and I am not sure how to do that.

basically i want to do the following: if X is less than 200 and greater than 100, then continue, else stop.

can someone provide some kind of starting point. i know i have to do a for loop, but not exactly sure how to go about it.

thanks in advance

You don''t need a for loop. Test for a condition with an if statement. If condition is met, do something. Otherwise, do something else.

Expand|Select|Wrap|Line Numbers


You don''t need a for loop. Test for a condition with an if statement. If condition is met, do something. Otherwise, do something else.

Expand|Select|Wrap|Line Numbers


sorry, i should have mentioned the whole thing because I am still unsure.
My x here is actually a list of values. And i have 2 lists of values that correspond to an id and I am trying to define parameters using the two lists. i just don''t know the proper notation and such to write the code:
i am trying the following with no sucess:

>>> x = fields [1] -- my list
>>> y = filelds [2] -- 2nd list
>>> if 100 <= x <= 200
>>>>> continue
>>>>>>> if 5 <= y <= 8
>>>>>>> print id (print the id that has the defined parameters)

Thanks again for any help

You will need a for loop after all. I take it that fields is a list of lists. Maybe something like the following?

Expand|Select|Wrap|Line Numbers


这篇关于我需要一些帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆