Code Simplifying And Correcting | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

Code Simplifying And Correcting

the code link is https://code.sololearn.com/ciXQqB0bR8D8 plz see the question commented there in the link. sololearn is not allowing it to be typed here because of word limits

14th Jan 2022, 3:51 PM
Arnav Mohan
Arnav Mohan - avatar
2 Antworten
+ 2
ARNAV MOHAN floor division makes this simpler. Presumably the contents of the list will be used later, otherwise you only need to input the length - not the list itself. x=list(input("ENTER THE VALUE TO CALCULATE THE MIDDLE ELEMENT'S INDEX: ")) y=len(x) a = (y+1)//2 if (y%2): print("\nTHE INDEX OF THE MIDDLE ELEMENT IS:", a) else: b = a+1 print("THE INDICES OF 2 MIDDLE ELEMENTS ARE:", a, "&", b)
14th Jan 2022, 5:12 PM
Brian
Brian - avatar
+ 1
@Brian Thanks friend:)
14th Jan 2022, 5:30 PM
Arnav Mohan
Arnav Mohan - avatar