Capitalize i
This commit is contained in:
committed by
İnanç Gümüş
parent
b6ca30c4bb
commit
27c12b9b58
@ -18,7 +18,7 @@ func main() {
|
||||
// are shared in the same package
|
||||
hello()
|
||||
|
||||
// but here, i can't access the fmt package without
|
||||
// but here, I can't access the fmt package without
|
||||
// importing it.
|
||||
//
|
||||
// this is because, it's in the printer.go's file scope.
|
||||
|
@ -13,7 +13,7 @@ import "fmt"
|
||||
func main() {
|
||||
const min = 42
|
||||
|
||||
// i've removed int from the below declaration
|
||||
// I've removed int from the below declaration
|
||||
// since, min's default type is int (you'll learn)
|
||||
var i = min
|
||||
|
||||
|
@ -25,7 +25,7 @@ package main
|
||||
// go run main.go hi there
|
||||
// There are two: "hi there"
|
||||
//
|
||||
// go run main.go i wanna be a gopher
|
||||
// go run main.go I wanna be a gopher
|
||||
// There are 5 arguments
|
||||
// ---------------------------------------------------------
|
||||
|
||||
|
@ -41,7 +41,7 @@ func main() {
|
||||
// saved := make([]float64, len(data))
|
||||
// copy(saved, data)
|
||||
|
||||
// #9: clone a slice using append nil (i prefer this)
|
||||
// #9: clone a slice using append nil (I prefer this)
|
||||
// saved := append([]float64(nil), data...)
|
||||
|
||||
// data[0] = 0 // #8
|
||||
|
@ -22,29 +22,29 @@ import (
|
||||
//
|
||||
// CURRENT OUTPUT
|
||||
//
|
||||
// [all my troubles seemed so far away oh i believe in yesterday now it looks as though they are here to stay]
|
||||
// [all my troubles seemed so far away oh I believe in yesterday now it looks as though they are here to stay]
|
||||
//
|
||||
// EXPECTED OUTPUT
|
||||
//
|
||||
// [yesterday all my troubles seemed so far away now it looks as though they are here to stay oh i believe in yesterday]
|
||||
// [yesterday all my troubles seemed so far away now it looks as though they are here to stay oh I believe in yesterday]
|
||||
//
|
||||
//
|
||||
// STEPS
|
||||
//
|
||||
// INITIAL SLICE:
|
||||
// [all my troubles seemed so far away oh i believe in yesterday now it looks as though they are here to stay]
|
||||
// [all my troubles seemed so far away oh I believe in yesterday now it looks as though they are here to stay]
|
||||
//
|
||||
//
|
||||
// 1. Prepend "yesterday" to the `lyric` slice.
|
||||
//
|
||||
// RESULT SHOULD BE:
|
||||
// [yesterday all my troubles seemed so far away oh i believe in yesterday now it looks as though they are here to stay]
|
||||
// [yesterday all my troubles seemed so far away oh I believe in yesterday now it looks as though they are here to stay]
|
||||
//
|
||||
//
|
||||
// 2. Put the words to the correct positions in the `lyric` slice.
|
||||
//
|
||||
// RESULT SHOULD BE:
|
||||
// [yesterday all my troubles seemed so far away now it looks as though they are here to stay oh i believe in yesterday]
|
||||
// [yesterday all my troubles seemed so far away now it looks as though they are here to stay oh I believe in yesterday]
|
||||
//
|
||||
//
|
||||
// 3. Print the `lyric` slice.
|
||||
@ -65,7 +65,7 @@ import (
|
||||
|
||||
func main() {
|
||||
// DON'T TOUCH THIS:
|
||||
lyric := strings.Fields(`all my troubles seemed so far away oh i believe in yesterday now it looks as though they are here to stay`)
|
||||
lyric := strings.Fields(`all my troubles seemed so far away oh I believe in yesterday now it looks as though they are here to stay`)
|
||||
|
||||
// ADD YOUR CODE BELOW:
|
||||
// ...
|
||||
|
@ -17,8 +17,8 @@ func main() {
|
||||
// --- Correct Lyric ---
|
||||
// yesterday all my troubles seemed so far away
|
||||
// now it looks as though they are here to stay
|
||||
// oh i believe in yesterday
|
||||
lyric := strings.Fields(`all my troubles seemed so far away oh i believe in yesterday now it looks as though they are here to stay`)
|
||||
// oh I believe in yesterday
|
||||
lyric := strings.Fields(`all my troubles seemed so far away oh I believe in yesterday now it looks as though they are here to stay`)
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// #1: Prepend "yesterday" to `lyric`
|
||||
@ -26,10 +26,10 @@ func main() {
|
||||
|
||||
//
|
||||
// --- BEFORE ---
|
||||
// all my troubles seemed so far away oh i believe in yesterday
|
||||
// all my troubles seemed so far away oh I believe in yesterday
|
||||
//
|
||||
// --- AFTER ---
|
||||
// yesterday all my troubles seemed so far away oh i believe in yesterday
|
||||
// yesterday all my troubles seemed so far away oh I believe in yesterday
|
||||
//
|
||||
// (warning: allocates a new backing array)
|
||||
//
|
||||
@ -40,7 +40,7 @@ func main() {
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// yesterday all my troubles seemed so far away oh i believe in yesterday
|
||||
// yesterday all my troubles seemed so far away oh I believe in yesterday
|
||||
// | |
|
||||
// v v
|
||||
// index: 8 pos: 13
|
||||
@ -49,10 +49,10 @@ func main() {
|
||||
|
||||
// --- BEFORE ---
|
||||
//
|
||||
// yesterday all my troubles seemed so far away oh i believe in yesterday now it looks as though they are here to stay
|
||||
// yesterday all my troubles seemed so far away oh I believe in yesterday now it looks as though they are here to stay
|
||||
//
|
||||
// --- AFTER ---
|
||||
// yesterday all my troubles seemed so far away oh i believe in yesterday now it looks as though they are here to stay oh i believe in yesterday
|
||||
// yesterday all my troubles seemed so far away oh I believe in yesterday now it looks as though they are here to stay oh I believe in yesterday
|
||||
// ^
|
||||
//
|
||||
// |
|
||||
@ -63,10 +63,10 @@ func main() {
|
||||
|
||||
//
|
||||
// --- BEFORE ---
|
||||
// yesterday all my troubles seemed so far away oh i believe in yesterday now it looks as though they are here to stay oh i believe in yesterday
|
||||
// yesterday all my troubles seemed so far away oh I believe in yesterday now it looks as though they are here to stay oh I believe in yesterday
|
||||
//
|
||||
// --- AFTER ---
|
||||
// yesterday all my troubles seemed so far away now it looks as though they are here to stay oh i believe in yesterday
|
||||
// yesterday all my troubles seemed so far away now it looks as though they are here to stay oh I believe in yesterday
|
||||
//
|
||||
// (does not allocate a new backing array because cap(lyric[:N]) > M)
|
||||
//
|
||||
|
@ -27,22 +27,22 @@ import (
|
||||
//
|
||||
// ORIGINAL SLICE:
|
||||
//
|
||||
// [yesterday all my troubles seemed so far away now it looks as though they are here to stay oh i believe in yesterday]
|
||||
// [yesterday all my troubles seemed so far away now it looks as though they are here to stay oh I believe in yesterday]
|
||||
//
|
||||
// EXPECTED SLICE (NEW):
|
||||
//
|
||||
// [yesterday all my troubles seemed so far \n away now it looks as though they are here to stay \n oh i believe in yesterday \n]
|
||||
// [yesterday all my troubles seemed so far \n away now it looks as though they are here to stay \n oh I believe in yesterday \n]
|
||||
//
|
||||
//
|
||||
// CURRENT OUTPUT
|
||||
//
|
||||
// yesterday all my troubles seemed so far away now it looks as though they are here to stay oh i believe in yesterday
|
||||
// yesterday all my troubles seemed so far away now it looks as though they are here to stay oh I believe in yesterday
|
||||
//
|
||||
// EXPECTED OUTPUT
|
||||
//
|
||||
// yesterday all my troubles seemed so far away
|
||||
// now it looks as though they are here to stay
|
||||
// oh i believe in yesterday
|
||||
// oh I believe in yesterday
|
||||
//
|
||||
//
|
||||
// RESTRICTIONS
|
||||
@ -72,7 +72,7 @@ import (
|
||||
func main() {
|
||||
// You need to add a newline after each sentence in another slice.
|
||||
// Don't touch the following code.
|
||||
lyric := strings.Fields(`yesterday all my troubles seemed so far away now it looks as though they are here to stay oh i believe in yesterday`)
|
||||
lyric := strings.Fields(`yesterday all my troubles seemed so far away now it looks as though they are here to stay oh I believe in yesterday`)
|
||||
|
||||
// ===================================
|
||||
//
|
||||
|
@ -16,7 +16,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
lyric := strings.Fields(`yesterday all my troubles seemed so far away now it looks as though they are here to stay oh i believe in yesterday`)
|
||||
lyric := strings.Fields(`yesterday all my troubles seemed so far away now it looks as though they are here to stay oh I believe in yesterday`)
|
||||
|
||||
// `+3` because we're going to add 3 newline characters to the fix slice.
|
||||
fix := make([]string, len(lyric)+3)
|
||||
@ -34,7 +34,7 @@ func main() {
|
||||
//
|
||||
// + The second sentence has 10 words so its cutting index is 10.
|
||||
//
|
||||
// now it looks as though they are here to stay oh i believe in yesterday
|
||||
// now it looks as though they are here to stay oh I believe in yesterday
|
||||
// |
|
||||
// v
|
||||
// cutting index: 10
|
||||
@ -42,7 +42,7 @@ func main() {
|
||||
//
|
||||
// + The last sentence has 5 words so its cutting index is 5.
|
||||
//
|
||||
// oh i believe in yesterday
|
||||
// oh I believe in yesterday
|
||||
// |
|
||||
// v
|
||||
// cutting index: 5
|
||||
|
@ -7,6 +7,6 @@ take him and cut him out in little stars
|
||||
and he will make the face of heaven so fine
|
||||
that all the world will be in love with night
|
||||
and pay no worship to the garish sun
|
||||
oh i have bought the mansion of love
|
||||
but not possessed it and though i am sold
|
||||
oh I have bought the mansion of love
|
||||
but not possessed it and though I am sold
|
||||
not yet enjoyed
|
@ -7,6 +7,6 @@ take him and cut him out in little stars
|
||||
and he will make the face of heaven so fine
|
||||
that all the world will be in love with night
|
||||
and pay no worship to the garish sun
|
||||
oh i have bought the mansion of love
|
||||
but not possessed it and though i am sold
|
||||
oh I have bought the mansion of love
|
||||
but not possessed it and though I am sold
|
||||
not yet enjoyed
|
@ -7,6 +7,6 @@ take him and cut him out in little stars
|
||||
and he will make the face of heaven so fine
|
||||
that all the world will be in love with night
|
||||
and pay no worship to the garish sun
|
||||
oh i have bought the mansion of love
|
||||
but not possessed it and though i am sold
|
||||
oh I have bought the mansion of love
|
||||
but not possessed it and though I am sold
|
||||
not yet enjoyed
|
@ -7,6 +7,6 @@ take him and cut him out in little stars
|
||||
and he will make the face of heaven so fine
|
||||
that all the world will be in love with night
|
||||
and pay no worship to the garish sun
|
||||
oh i have bought the mansion of love
|
||||
but not possessed it and though i am sold
|
||||
oh I have bought the mansion of love
|
||||
but not possessed it and though I am sold
|
||||
not yet enjoyed
|
@ -7,6 +7,6 @@ take him and cut him out in little stars
|
||||
and he will make the face of heaven so fine
|
||||
that all the world will be in love with night
|
||||
and pay no worship to the garish sun
|
||||
oh i have bought the mansion of love
|
||||
but not possessed it and though i am sold
|
||||
oh I have bought the mansion of love
|
||||
but not possessed it and though I am sold
|
||||
not yet enjoyed
|
@ -7,6 +7,6 @@ take him and cut him out in little stars
|
||||
and he will make the face of heaven so fine
|
||||
that all the world will be in love with night
|
||||
and pay no worship to the garish sun
|
||||
oh i have bought the mansion of love
|
||||
but not possessed it and though i am sold
|
||||
oh I have bought the mansion of love
|
||||
but not possessed it and though I am sold
|
||||
not yet enjoyed
|
@ -7,6 +7,6 @@ take him and cut him out in little stars
|
||||
and he will make the face of heaven so fine
|
||||
that all the world will be in love with night
|
||||
and pay no worship to the garish sun
|
||||
oh i have bought the mansion of love
|
||||
but not possessed it and though i am sold
|
||||
oh I have bought the mansion of love
|
||||
but not possessed it and though I am sold
|
||||
not yet enjoyed
|
@ -29,7 +29,7 @@ package main
|
||||
// wrong id
|
||||
//
|
||||
// id 10
|
||||
// sorry. i don't have the game
|
||||
// sorry. I don't have the game
|
||||
//
|
||||
// id 1
|
||||
// #1: "god of war" (action adventure) $50
|
||||
|
@ -90,7 +90,7 @@ func main() {
|
||||
|
||||
g, ok := byID[id]
|
||||
if !ok {
|
||||
fmt.Println("sorry. i don't have the game")
|
||||
fmt.Println("sorry. I don't have the game")
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ func main() {
|
||||
|
||||
g, ok := byID[id]
|
||||
if !ok {
|
||||
fmt.Println("sorry. i don't have the game")
|
||||
fmt.Println("sorry. I don't have the game")
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ func main() {
|
||||
|
||||
g, ok := byID[id]
|
||||
if !ok {
|
||||
fmt.Println("sorry. i don't have the game")
|
||||
fmt.Println("sorry. I don't have the game")
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ func main() {
|
||||
|
||||
g, ok := byID[id]
|
||||
if !ok {
|
||||
fmt.Println("sorry. i don't have the game")
|
||||
fmt.Println("sorry. I don't have the game")
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ func main() {
|
||||
|
||||
g, ok := byID[id]
|
||||
if !ok {
|
||||
fmt.Println("sorry. i don't have the game")
|
||||
fmt.Println("sorry. I don't have the game")
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ func main() {
|
||||
|
||||
g, ok := byID[id]
|
||||
if !ok {
|
||||
fmt.Println("sorry. i don't have the game")
|
||||
fmt.Println("sorry. I don't have the game")
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ func cmdByID(cmd []string, games []game, byID map[int]game) bool {
|
||||
|
||||
g, ok := byID[id]
|
||||
if !ok {
|
||||
fmt.Println("sorry. i don't have the game")
|
||||
fmt.Println("sorry. I don't have the game")
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ func cmdByID(cmd []string, games []game, byID map[int]game) bool {
|
||||
|
||||
g, ok := byID[id]
|
||||
if !ok {
|
||||
fmt.Println("sorry. i don't have the game")
|
||||
fmt.Println("sorry. I don't have the game")
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ func cmdByID(cmd []string, games []game, byID map[int]game) bool {
|
||||
|
||||
g, ok := byID[id]
|
||||
if !ok {
|
||||
fmt.Println("sorry. i don't have the game")
|
||||
fmt.Println("sorry. I don't have the game")
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,6 @@ take him and cut him out in little stars
|
||||
and he will make the face of heaven so fine
|
||||
that all the world will be in love with night
|
||||
and pay no worship to the garish sun
|
||||
oh i have bought the mansion of love
|
||||
but not possessed it and though i am sold
|
||||
oh I have bought the mansion of love
|
||||
but not possessed it and though I am sold
|
||||
not yet enjoyed
|
@ -7,6 +7,6 @@ take him and cut him out in little stars
|
||||
and he will make the face of heaven so fine
|
||||
that all the world will be in love with night
|
||||
and pay no worship to the garish sun
|
||||
oh i have bought the mansion of love
|
||||
but not possessed it and though i am sold
|
||||
oh I have bought the mansion of love
|
||||
but not possessed it and though I am sold
|
||||
not yet enjoyed
|
@ -7,6 +7,6 @@ take him and cut him out in little stars
|
||||
and he will make the face of heaven so fine
|
||||
that all the world will be in love with night
|
||||
and pay no worship to the garish sun
|
||||
oh i have bought the mansion of love
|
||||
but not possessed it and though i am sold
|
||||
oh I have bought the mansion of love
|
||||
but not possessed it and though I am sold
|
||||
not yet enjoyed
|
@ -7,6 +7,6 @@ take him and cut him out in little stars
|
||||
and he will make the face of heaven so fine
|
||||
that all the world will be in love with night
|
||||
and pay no worship to the garish sun
|
||||
oh i have bought the mansion of love
|
||||
but not possessed it and though i am sold
|
||||
oh I have bought the mansion of love
|
||||
but not possessed it and though I am sold
|
||||
not yet enjoyed
|
Reference in New Issue
Block a user