From 18d1aab96868036c2f7b4554ba43d2657facc477 Mon Sep 17 00:00:00 2001 From: Tiago Collot Date: Wed, 12 Oct 2022 11:43:27 +0100 Subject: [PATCH] docs(secondhalf): fix subject - rename exercise title - upgrade instructions - add missing import 'piscine' - fix white-spaces and indentation --- subjects/secondslice/README.md | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/subjects/secondslice/README.md b/subjects/secondslice/README.md index 63e10ecd..232c11d2 100644 --- a/subjects/secondslice/README.md +++ b/subjects/secondslice/README.md @@ -1,38 +1,41 @@ -## Second-Slice +## secondhalf ### Instructions -Write a function that receives a slice with integers and returns a new one with the last half of the values. If the length is odd, round it down. +Write a function `SecondHalf()` that receives a slice of `int` and returns another slice of `int` with the last half of the values. + +- If the length is odd, round it down. ### Expected function ```go -func SecondSlice(slice []int) []int { +func SecondHalf(slice []int) []int { } ``` ### Usage -Here is a possible program to test your function : +Here is a possible program to test your function: ```go package main import ( "fmt" + "piscine" ) func main() { - fmt.Println(SecondHalf([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10})) - fmt.Println(SecondHalf([]int{1, 2, 3})) + fmt.Println(piscine.SecondHalf([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10})) + fmt.Println(piscine.SecondHalf([]int{1, 2, 3})) } ``` -And its output : +And its output: ```console -$ go run . -[5,6,7,8,9,10] -[2,3] -``` \ No newline at end of file +$ go run . | cat -e +[5 6 7 8 9 10] +[2 3] +```