educative.io

Educative

Incorrect response

The quiz suggest a response that is incorrect:
the following code in quiz results in [9,8] but quiz indicates that it is [3,9]
fn main() {

let my_vec = vec![2, 3, 9, 8,7];
let slice:&[i32] = &my_vec[2…4]; // -> that is [9,8] not [3.9]
println!(“Slice of the vector : {:?}”, slice);

}

Hi Maxim,

This is Anum from Educative. Thank you for reaching out to us.
The correct option is [9,8] and the response is also [9,8]. Please check it again and let us know if there is any ambiguity.

Again, thank you for your valuable feedback! If you have any further queries, please let us know.

Happy Learning! :slight_smile:

Best Regards,

Anum Hassan
Developer Advocate
Educative.io