Subtraction | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Subtraction

How do I subtract the value of the first element in the array from the value in the last element of the array without typing (ages[7] – ages[0] ?

3rd Jun 2019, 3:11 PM
Jarom
Jarom - avatar
4 Antworten
+ 1
I mean, that isn't too complicated (and there are no other ways), what is your problem with that
3rd Jun 2019, 3:49 PM
Airree
Airree - avatar
0
there may be n elements in a list. print(ages[-1] - ages[0])
3rd Jun 2019, 4:37 PM
Choe
Choe - avatar
0
im trying to figure out how to complete it without going against the prvovided instructions.
3rd Jun 2019, 8:26 PM
Jarom
Jarom - avatar
0
a[0] - a[a.length-1]
4th Jun 2019, 12:56 AM
zemiak