Recap Challenge #1
Lesson 15 of 21 in Coddy's Slices and Maps in Golang course.
Challenge
EasyIn the given code, we define a slice. Take two inputs from the user, <strong>num1</strong> and <strong>num2</strong>, as indexes, and delete the items with those indexes from the slice.
Try it yourself
package main
import (
"fmt"
)
func main() {
// Get the input from the user for num1 and num2 as indexes Don't Change this
var num1, num2 int = 2, 4
fmt.Scan(&num1)
fmt.Scan(&num2)
// A slice of string elements Don't Change this
str := []string{"Haskell", "Python", "Golang", "JavaScript", "TypeScript"}
// Delete items with the same indexes from the slice
// Print the updated slice
fmt.Println("Updated slice:", str)
}All lessons in Slices and Maps in Golang
1Introduction
Introduction3Slices Behind the Scene
Slice is an ArraySlice with MakeCopy a SliceDelete an ElementRecap Challenge #1Recap Challenge #2