refactor: 6th section first two lectures exercises and questions
This commit is contained in:
@ -8,12 +8,18 @@
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE
|
||||
// 1- Print a few integer literals
|
||||
// 2- Print a few float literals
|
||||
// 3- Print true and false bool literals
|
||||
// 4- Print your name using a string literal
|
||||
// 5- Print a non-english sentence using a string literal
|
||||
// EXERCISE: Print the literals
|
||||
//
|
||||
// 1. Print a few integer literals
|
||||
//
|
||||
// 2. Print a few float literals
|
||||
//
|
||||
// 3. Print true and false bool literals
|
||||
//
|
||||
// 4. Print your name using a string literal
|
||||
//
|
||||
// 5. Print a non-english sentence using a string literal
|
||||
//
|
||||
// ---------------------------------------------------------
|
||||
|
||||
func main() {
|
@ -12,18 +12,19 @@ import "fmt"
|
||||
// THIS EXERCISE IS OPTIONAL
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE
|
||||
// 1- Print 0 to 9 in hexadecimal
|
||||
// 2- Print 10 to 15 in hexadecimal
|
||||
// 3- Print 17 in hexadecimal
|
||||
// 4- Print 25 in hexadecimal
|
||||
// 5- Print 50 in hexadecimal
|
||||
// 6- Print 100 in hexadecimal
|
||||
// EXERCISE: Print hexes
|
||||
//
|
||||
// NOTES
|
||||
// https://stackoverflow.com/questions/910309/how-to-turn-hexadecimal-into-decimal-using-brain
|
||||
// 1. Print 0 to 9 in hexadecimal
|
||||
//
|
||||
// https://simple.wikipedia.org/wiki/Hexadecimal_numeral_system
|
||||
// 2. Print 10 to 15 in hexadecimal
|
||||
//
|
||||
// 3. Print 17 in hexadecimal
|
||||
//
|
||||
// 4. Print 25 in hexadecimal
|
||||
//
|
||||
// 5. Print 50 in hexadecimal
|
||||
//
|
||||
// 6. Print 100 in hexadecimal
|
||||
//
|
||||
// EXPECTED OUTPUT
|
||||
// 0 1 2 3 4 5 6 7 8 9
|
||||
@ -32,6 +33,12 @@ import "fmt"
|
||||
// 25
|
||||
// 50
|
||||
// 100
|
||||
//
|
||||
// NOTES
|
||||
// https://stackoverflow.com/questions/910309/how-to-turn-hexadecimal-into-decimal-using-brain
|
||||
//
|
||||
// https://simple.wikipedia.org/wiki/Hexadecimal_numeral_system
|
||||
//
|
||||
// ---------------------------------------------------------
|
||||
|
||||
func main() {
|
7
06-variables/01-basic-data-types/exercises/README.md
Normal file
7
06-variables/01-basic-data-types/exercises/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
1. **[Print the literals](https://github.com/inancgumus/learngo/tree/master/06-variables/01-basic-data-types/exercises/01-print-the-literals)**
|
||||
|
||||
Print a few values using the literals
|
||||
|
||||
2. **[Print hexes](https://github.com/inancgumus/learngo/tree/master/06-variables/01-basic-data-types/exercises/02-print-hexes)** (optional exercise)
|
||||
|
||||
Print numbers in hexadecimals
|
@ -8,9 +8,11 @@
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE
|
||||
// 1- Declare and print a variable with a float64 type
|
||||
// 2- The declared variable's name should be: brightness
|
||||
// EXERCISE: Declare int
|
||||
//
|
||||
// 1. Declare and print a variable with an int type
|
||||
//
|
||||
// 2. The declared variable's name should be: height
|
||||
//
|
||||
// EXPECTED OUTPUT
|
||||
// 0
|
@ -8,9 +8,11 @@
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// OPTIONAL EXERCISE
|
||||
// 1- Declare and print a bool variable
|
||||
// 2- The variable's name should be: isOn
|
||||
// EXERCISE: Declare bool
|
||||
//
|
||||
// 1. Declare and print a bool variable
|
||||
//
|
||||
// 2. The variable's name should be: isOn
|
||||
//
|
||||
// EXPECTED OUTPUT
|
||||
// false
|
@ -8,9 +8,11 @@
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE
|
||||
// 1- Declare and print a variable with an int type
|
||||
// 2- The declared variable's name should be: height
|
||||
// EXERCISE: Declare float64
|
||||
//
|
||||
// 1. Declare and print a variable with a float64 type
|
||||
//
|
||||
// 2. The declared variable's name should be: brightness
|
||||
//
|
||||
// EXPECTED OUTPUT
|
||||
// 0
|
@ -8,9 +8,11 @@
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE
|
||||
// 1- Declare a string variable
|
||||
// 2- Print that variable
|
||||
// EXERCISE: Declare string
|
||||
//
|
||||
// 1. Declare a string variable
|
||||
//
|
||||
// 2. Print that variable
|
||||
//
|
||||
// EXPECTED OUTPUT
|
||||
// ""
|
@ -8,8 +8,9 @@
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE
|
||||
// 1- Declare the variables below:
|
||||
// EXERCISE: Undeclarables
|
||||
//
|
||||
// 1. Declare the variables below:
|
||||
// 3speed
|
||||
// !speed
|
||||
// spe?ed
|
||||
@ -17,7 +18,7 @@ package main
|
||||
// func
|
||||
// package
|
||||
//
|
||||
// 2- Observe the error messages
|
||||
// 2. Observe the error messages
|
||||
//
|
||||
// NOTE
|
||||
// The types of the variables are not important.
|
@ -8,8 +8,9 @@
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE
|
||||
// 1- Declare a few variables using the following types
|
||||
// EXERCISE: Declare with bits
|
||||
//
|
||||
// 1. Declare a few variables using the following types
|
||||
// int
|
||||
// int8
|
||||
// int16
|
||||
@ -24,8 +25,9 @@ package main
|
||||
// rune
|
||||
// byte
|
||||
//
|
||||
// 2- Observe their output
|
||||
// 3- After you've done, check out the solution
|
||||
// 2. Observe their output
|
||||
//
|
||||
// 3. After you've done, check out the solution
|
||||
// and read the comments there
|
||||
//
|
||||
// EXPECTED OUTPUT
|
@ -8,7 +8,8 @@
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE
|
||||
// EXERCISE: Multiple
|
||||
//
|
||||
// 1. Declare two variables using
|
||||
// multiple variable declaration statement
|
||||
//
|
@ -8,7 +8,8 @@
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE
|
||||
// EXERCISE: Multiple #2
|
||||
//
|
||||
// 1. Declare and initialize two string variables
|
||||
// using multiple variable declaration
|
||||
//
|
@ -8,10 +8,13 @@
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE
|
||||
// 1- Declare a variable
|
||||
// 2- Variable's name should be: isLiquid
|
||||
// 3- Discard it using a blank-identifier
|
||||
// EXERCISE: Unused
|
||||
//
|
||||
// 1. Declare a variable
|
||||
//
|
||||
// 2. Variable's name should be: isLiquid
|
||||
//
|
||||
// 3. Discard it using a blank-identifier
|
||||
//
|
||||
// NOTE
|
||||
// Do not print the variable
|
@ -8,10 +8,11 @@
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE
|
||||
// 1- Declare a variable in the package-scope
|
||||
// EXERCISE: Package Variable
|
||||
//
|
||||
// 2- Observe whether something happens when you don't
|
||||
// 1. Declare a variable in the package-scope
|
||||
//
|
||||
// 2. Observe whether something happens when you don't
|
||||
// use it
|
||||
// ---------------------------------------------------------
|
||||
|
@ -8,11 +8,14 @@
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE
|
||||
// 1- Print a variable
|
||||
// 2- Then declare it
|
||||
// EXERCISE: Wrong doer
|
||||
//
|
||||
// 1. Print a variable
|
||||
//
|
||||
// 2. Then declare it
|
||||
// (This means: Try to print it before its declaration)
|
||||
// 3- Observe the error
|
||||
//
|
||||
// 3. Observe the error
|
||||
// ---------------------------------------------------------
|
||||
|
||||
func main() {
|
25
06-variables/02-declarations/exercises/README.md
Normal file
25
06-variables/02-declarations/exercises/README.md
Normal file
@ -0,0 +1,25 @@
|
||||
# Declare and Print Variables
|
||||
|
||||
Warm up. Declare a few variables and get some experience. Get used to the variable declaration syntax.
|
||||
|
||||
1. **[Declare int](https://github.com/inancgumus/learngo/tree/master/06-variables/02-declarations/exercises/01-int)**
|
||||
|
||||
2. **[Declare bool](https://github.com/inancgumus/learngo/tree/master/06-variables/02-declarations/exercises/02-bool)**
|
||||
|
||||
3. **[Declare float64](https://github.com/inancgumus/learngo/tree/master/06-variables/02-declarations/exercises/03-float64)**
|
||||
|
||||
4. **[Declare string](https://github.com/inancgumus/learngo/tree/master/06-variables/02-declarations/exercises/04-string)**
|
||||
|
||||
5. **[Declare undeclarables](https://github.com/inancgumus/learngo/tree/master/06-variables/02-declarations/exercises/05-undeclarables)**
|
||||
|
||||
6. **[Declare with bits](https://github.com/inancgumus/learngo/tree/master/06-variables/02-declarations/exercises/06-with-bits)**
|
||||
|
||||
7. **[Declare multiple](https://github.com/inancgumus/learngo/tree/master/06-variables/02-declarations/exercises/07-multiple)**
|
||||
|
||||
8. **[Declare multiple 2](https://github.com/inancgumus/learngo/tree/master/06-variables/02-declarations/exercises/08-multiple-2)**
|
||||
|
||||
9. **[Declare an unused variable](https://github.com/inancgumus/learngo/tree/master/06-variables/02-declarations/exercises/09-unused)**
|
||||
|
||||
10. **[Declare a package variable](https://github.com/inancgumus/learngo/tree/master/06-variables/02-declarations/exercises/10-package-variable)**
|
||||
|
||||
11. **[Use before declare](https://github.com/inancgumus/learngo/tree/master/06-variables/02-declarations/exercises/11-wrong-doer)**
|
Reference in New Issue
Block a user