Initial commit

This commit is contained in:
Inanc Gumus
2018-10-13 23:30:21 +03:00
commit cde4e6632c
567 changed files with 17896 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
// ---------------------------------------------------------
// EXERCISE
// Print your age using Prinft
//
// EXPECTED OUTPUT
// My age is 30 years old.
//
// NOTE
// You should change 30 to your age, of course.
// ---------------------------------------------------------
func main() {
// ?
}

View File

@@ -0,0 +1,14 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
import "fmt"
func main() {
fmt.Printf("My age is %d years old.\n", 30)
}

View File

@@ -0,0 +1,27 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
// ---------------------------------------------------------
// EXERCISE
// Print your name and lastname using Printf
//
// EXPECTED OUTPUT
// My name is Inanc and my lastname is Gumus.
//
// BONUS
// Store the formatting specifier (first argument of Printf)
// in a variable.
// Then pass it to printf
// ---------------------------------------------------------
func main() {
// BONUS: Use a variable for the format specifier
// fmt.Printf("?", ?, ?)
}

View File

@@ -0,0 +1,18 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
import "fmt"
func main() {
fmt.Printf("My name is %s and my lastname is %s.\n", "Inanc", "Gumus")
// BONUS
msg := "My name is %s and my lastname is %s.\n"
fmt.Printf(msg, "Inanc", "Gumus")
}

View File

@@ -0,0 +1,25 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
// ---------------------------------------------------------
// EXERCISE
// Use printf to print the expected output using a variable.
//
// EXPECTED OUTPUT
// These are false claims.
// ---------------------------------------------------------
func main() {
// UNCOMMENT THE FOLLOWING CODE
// AND DO NOT CHANGE IT AFTERWARDS
// tf := false
// TYPE YOUR CODE HERE
// ?
}

View File

@@ -0,0 +1,15 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
import "fmt"
func main() {
tf := false
fmt.Printf("These are %t claims.\n", tf)
}

View File

@@ -0,0 +1,24 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
// ---------------------------------------------------------
// EXERCISE
// Print the current temperature in your area using Printf
//
// NOTE
// Do not use %v verb
// Output "shouldn't" be like 29.500000
//
// EXPECTED OUTPUT
// Temperature is 29.5 degrees.
// ---------------------------------------------------------
func main() {
// ?
}

View File

@@ -0,0 +1,14 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
import "fmt"
func main() {
fmt.Printf("Temperature is %.1f degrees.\n", 29.5)
}

View File

@@ -0,0 +1,24 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
// ---------------------------------------------------------
// EXERCISE
// Print "hello world" with double-quotes using Printf
// (As you see here)
//
// NOTE
// Output "shouldn't" be just: hello world
//
// EXPECTED OUTPUT
// "hello world"
// ---------------------------------------------------------
func main() {
// ?
}

View File

@@ -0,0 +1,14 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
import "fmt"
func main() {
fmt.Printf("%q\n", "hello world")
}

View File

@@ -0,0 +1,20 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
// ---------------------------------------------------------
// EXERCISE
// Print the type and value of 3 using fmt.Printf
//
// EXPECTED OUTPUT
// Type of 3 is int
// ---------------------------------------------------------
func main() {
// ?
}

View File

@@ -0,0 +1,14 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
import "fmt"
func main() {
fmt.Printf("Type of %d is %T\n", 3, 3)
}

View File

@@ -0,0 +1,20 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
// ---------------------------------------------------------
// EXERCISE
// Print the type and value of 3.14 using fmt.Printf
//
// EXPECTED OUTPUT
// Type of 3.14 is float64
// ---------------------------------------------------------
func main() {
// ?
}

View File

@@ -0,0 +1,14 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
import "fmt"
func main() {
fmt.Printf("Type of %f is %T\n", 3.14, 3.14)
}

View File

@@ -0,0 +1,20 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
// ---------------------------------------------------------
// EXERCISE
// Print the type and value of "hello" using fmt.Printf
//
// EXPECTED OUTPUT
// Type of hello is string
// ---------------------------------------------------------
func main() {
// ?
}

View File

@@ -0,0 +1,14 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
import "fmt"
func main() {
fmt.Printf("Type of %s is %T\n", "hello", "hello")
}

View File

@@ -0,0 +1,20 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
// ---------------------------------------------------------
// EXERCISE
// Print the type and value of true using fmt.Printf
//
// EXPECTED OUTPUT
// Type of true is bool
// ---------------------------------------------------------
func main() {
// ?
}

View File

@@ -0,0 +1,14 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
import "fmt"
func main() {
fmt.Printf("Type of %t is %T\n", true, true)
}

View File

@@ -0,0 +1,24 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
// ---------------------------------------------------------
// EXERCISE
// 1. Get your name and lastname from the command-line
// 2. Print them using Printf
//
// EXAMPLE INPUT
// Inanc Gumus
//
// EXPECTED OUTPUT
// Your name is Inanc and your lastname is Gumus.
// ---------------------------------------------------------
func main() {
// BONUS: Use a variable for the format specifier
}

View File

@@ -0,0 +1,23 @@
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
import (
"fmt"
"os"
)
func main() {
// WARNING: This program will error
// if you don't pass your name and lastname
name, lastname := os.Args[1], os.Args[2]
msg := "Your name is %s and your lastname is %s.\n"
fmt.Printf(msg, name, lastname)
}