+ 5
What does a>b means here?
a=[7,3,9,5] b=[8,0,4] If a>b: print(len(a)) else: print(len(b)) Answer is 3
6 Antworten
+ 7
First of all, it should be "if" i.e. in lowercase
If is a conditional statement
It compares a and b
But since a and b are lists, it compares first elements of both a and b
If the first elements are equal, it will compare the next elements.
So, here,
7>8 which evaluates with False
So it executes the else part.
And it prints the length of b which is 3...
What do you actually want to do with the lists?
+ 7
Interesting Question, i made a code for this one..
and elaborated in code.
https://code.sololearn.com/cfwn0t2z5NOx/?ref=app
Extending to the answer provided by Kartik Krishnan.
+ 4
Thanks it's a challenge question in Python
I was not able to understand it
Typing mistake if
0
سلام
- 1
It refers to the length of the list....
- 2
> = bigger than
Example:
a = 5
b = 1
If a>b returns true