Skip to content

Commit 094f1f0

Browse files
committed
solve(learngo): 07-printf
1 parent f61a4a9 commit 094f1f0

File tree

27 files changed

+63
-346
lines changed

27 files changed

+63
-346
lines changed

collections/learngo/07-printf/01-intro/01-println-vs-printf/main.go

Lines changed: 0 additions & 24 deletions
This file was deleted.

collections/learngo/07-printf/01-intro/02/main.go

Lines changed: 0 additions & 21 deletions
This file was deleted.

collections/learngo/07-printf/02-escape-sequences/main.go

Lines changed: 0 additions & 26 deletions
This file was deleted.

collections/learngo/07-printf/03-printing-types/main.go

Lines changed: 0 additions & 26 deletions
This file was deleted.

collections/learngo/07-printf/04-coding/main.go

Lines changed: 0 additions & 52 deletions
This file was deleted.

collections/learngo/07-printf/exercises/01-print-your-age/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
package main
1010

11+
import "fmt"
12+
1113
// ---------------------------------------------------------
1214
// EXERCISE: Print Your Age
1315
//
@@ -21,5 +23,5 @@ package main
2123
// ---------------------------------------------------------
2224

2325
func main() {
24-
// ?
26+
fmt.Printf("I'm %d years old.\n", 21)
2527
}

collections/learngo/07-printf/exercises/01-print-your-age/solution/main.go

Lines changed: 0 additions & 15 deletions
This file was deleted.

collections/learngo/07-printf/exercises/02-print-your-name-and-lastname/main.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
package main
1010

11+
import "fmt"
12+
1113
// ---------------------------------------------------------
1214
// EXERCISE: Print Your Name and LastName
1315
//
@@ -16,14 +18,10 @@ package main
1618
// EXPECTED OUTPUT
1719
// My name is Inanc and my lastname is Gumus.
1820
//
19-
// BONUS
20-
// Store the formatting specifier (first argument of Printf)
21-
// in a variable.
22-
// Then pass it to printf
2321
// ---------------------------------------------------------
2422

2523
func main() {
2624
// BONUS: Use a variable for the format specifier
27-
28-
// fmt.Printf("?", ?, ?)
25+
name := "Slaweak"
26+
fmt.Printf("My name is %s and my lastname is %s", name, "Dmitriev")
2927
}

collections/learngo/07-printf/exercises/02-print-your-name-and-lastname/solution/main.go

Lines changed: 0 additions & 19 deletions
This file was deleted.

collections/learngo/07-printf/exercises/03-false-claims/main.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
package main
1010

11+
import "fmt"
12+
1113
// ---------------------------------------------------------
1214
// EXERCISE: False Claims
1315
//
@@ -18,10 +20,7 @@ package main
1820
// ---------------------------------------------------------
1921

2022
func main() {
21-
// UNCOMMENT THE FOLLOWING CODE
22-
// AND DO NOT CHANGE IT AFTERWARDS
23-
// tf := false
23+
tf := false
2424

25-
// TYPE YOUR CODE HERE
26-
// ?
25+
fmt.Printf("These are %t claims", tf)
2726
}

0 commit comments

Comments
 (0)