+ 1

Python Input/List question

So I know that this code technically functions but it seems like there must be a simplified way. Please take a look and let me know if there is. Thank you https://code.sololearn.com/c8ms5uNZWT14/?ref=app

17th Aug 2020, 4:18 AM
Accuracy
Accuracy - avatar
4 Réponses
+ 7
Can't access it. Paste the code into a new code in the playground, save it and paste the link here.
17th Aug 2020, 4:23 AM
David Ashton
David Ashton - avatar
+ 2
fruits = ["apple", "cherry", "banana", "kiwi", "lemon", "pear", "peach", "avocado"] print(fruits[int(input())])
17th Aug 2020, 7:30 AM
Rik Wittkopp
Rik Wittkopp - avatar
0
Updated, apologies
17th Aug 2020, 4:27 AM
Accuracy
Accuracy - avatar