Hello.
I receive a number like: ‘n’ from input, which means I will receive ‘n’ two number;
The first one is price and the second one is quality.
I should evaluated the numbers. If I can find the below condition I will print out ‘happy’ and on the other hands print out ‘poor’.
**the price is lower that other and in the same condition the qualities is higher.**
For first example:
Second example:
I have wrote below code is it okay? Can you see any problem in it? Or any propose to make it easier?
I receive a number like: ‘n’ from input, which means I will receive ‘n’ two number;
The first one is price and the second one is quality.
I should evaluated the numbers. If I can find the below condition I will print out ‘happy’ and on the other hands print out ‘poor’.
**the price is lower that other and in the same condition the qualities is higher.**
For first example:
Quote:4The output will be ‘happy’
2 9
5 1
Second example:
Quote:4The output will be ‘poor’
1 5
7 9
5 6
20 30
I have wrote below code is it okay? Can you see any problem in it? Or any propose to make it easier?
n = input() finallist=[] for i in range (0,int(n)): listlap = [int(x) for x in input().split()] finallist.append(listlap) l2=sum(finallist,[]) c=0 c1=0 for i in range(0, len(l2), 2): while str(l2[i])<str(l2[i+1]): c=c+1 break else: c1=c1+1 break if (c+c1)==2: print('happy') else: print('poor')