How to code a conditional statement

I am stuck with a piece of code. What is the# exact coding for:

If the index number is less than the item value in an array ?

any one please help[.

Show us your code, tell us what you tried, we will try to help.

1 Like

if array.index < array.item : ‘statement’
elif array.index == array.item: ‘statement’
elif array.index > array.item: ‘statement’

Looks like python.
There are few mistakes.

First and second one is accessing list items and indexes.

Third one is = operator.

Good luck.

@discobot, Whether I am pretty well in # learning new tricks ?

num = []
num2 = []
num3 = []
list = [2,1,4,6,1,8]
num.extend(list)
print('num is :',num)
for i in num:
    if i != num.index:
        num2.append(i)
        print('num2 is : ',num2)
a =num.index
print('num index is ;' ,a)

This is only a part of some learning tricks as suggested by the @discobot

Hi! To find out what I can do, say @discobot display help.

@discobot ,
display help

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.