Q. Write a program to read two lists num and denum which contain the numerators and denominators of same fractions at the respective indexes. Then display the smallest fraction along with its index.
Answer =
num = eval(input("Enter numerators list :-")) denum = eval(input("Enter denominators list :-")) lst = [ ] for i in range(len(num)) : fraction = num[ i ] / denum[ i ] lst.append( fraction ) lst.sort() print("Smallest fraction = ",lst[ 0 ])
Output : -
Enter numerators list :-[0,2,4,6,8]
Enter denominators list :-[1,3,5,7,9]
Smallest fraction = 0.0
>>>
Enter denominators list :-[1,3,5,7,9]
Smallest fraction = 0.0
>>>
Enter numerators list :-[98,45,23,47]
Enter denumerators list :-[54,26,89,74]
Smallest fraction = 0.25842696629213485
>>>
Enter denumerators list :-[54,26,89,74]
Smallest fraction = 0.25842696629213485
>>>
wrong program error is occuring
ReplyDeleteplease copy the above code and run in your python application.
DeleteDisplay min with index
ReplyDeleteCheck the program again i have written.
DeleteThank You So Much
ReplyDeleteWelcome : )
DeleteBRO OUTPUT :/
ReplyDeleteOk.. : )
Deletecheck the video?
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )