0
How do I get a random element from a List ?
https://sololearn.com/coach/135/?ref=app Pls help me solve this :)
9 ответов
+ 9
Radhika Seelam This is a really simple code coach solutions question
* python
Imagine a vending machine that sells fruits. Each fruit has its own number, starting from 0.
Write a program for the vending machine, which will take n number as input from the customer and return the fruit with that index.
If n< 0 or n>7 (the index of last fruit ), the program outputs "Wrong number".
Sample Input:
2
Sample Output:
banana
The list has 8 fruits
• code coach solution which is meant for you to do to help you establish your skills abilities and where you need to learn...
Please show us your attempt
Vasiliy this is his problem / assignment
+ 5
Radhika Seelam
Everything is fine, but you forgot to describe one more condition:
If n<0 or n>7 (the index of last fruit ), the program outputs "Wrong number".
+ 2
This task is available only to users of the PRO version.
Describe the assignment, specify the programming language in the tag, and provide your code attempt.
+ 2
BroFar, thanks for the assignment. ☺️
The only thing left to do is to understand why Radhika Seelam is asking to get a random item from the list? 🤔
+ 2
Thanks so much Vasiliy 🙂
I got it
+ 2
By Creating A Rand Number And make {YourArrayName[Rand]}
+ 1
Is this app really worth it
+ 1
I can't access the link either because I am not a Pro