fix: newline in question markdowns

This commit is contained in:
Inanc Gumus
2018-10-19 20:38:00 +03:00
parent dc4aaea4fa
commit dc7588fc5c
7 changed files with 2 additions and 101 deletions

View File

@ -12,10 +12,8 @@
> **4:** Nice Try. But, that's not right. Sorry.
>
>
> **3:** That's right. The remainder operator only works on integer values.
>
>
## What's the result of this expression?
@ -49,7 +47,6 @@ var degree float64 = 10 / 4
> **3:** That's right. An integer value cannot contain fractional parts.
>
>
## What's the result of this expression?
@ -63,7 +60,6 @@ var degree float64 = 3. / 2
> **1:** That's right. `3.` makes the whole expression a float value.
>
>
## What's the type of the `x` variable?
@ -77,16 +73,12 @@ x := 5 * 2.
> **1:** Look closely to 2 there.
>
>
> **2:** Why? Because, `2.` there makes the expressions a float value. Cool.
>
>
> **3:** Oh, come on! Life is not always true and false.
>
>
> **4:** I can't see any double-quotes or back-quotes, can you?
>
>
## What's the type of the `x` variable?
@ -100,16 +92,12 @@ x := 5 * -(2)
> **1:** Why? Because, there only integer numbers.
>
>
> **2:** I can't see any fractional parts there, can you?
>
>
> **3:** Oh, come on! Life is not always true and false.
>
>
> **4:** I can't see any double-quotes or back-quotes, can you?
>
>
## Which kind of values can result in inaccurate calculations?

View File

@ -9,13 +9,10 @@ var n float64
> **1:** This just assigns 1 to n.
>
>
> **2:** IncDec statement can't be used as an operator.
>
>
> **4:** Go doesn't support prefix incdec notation.
>
>
## Which expression decreases `n` by 1?
@ -29,13 +26,10 @@ var n int
> **1:** This just assigns -1 to n.
>
>
> **2:** IncDec statement can't be used as an operator.
>
>
> **4:** Go doesn't support prefix incdec notation.
>
>
## Which code below equals to `n = n + 1`?
@ -46,13 +40,10 @@ var n int
> **2:** IncDec statement can't be used as an operator.
>
>
> **3:** Go doesn't support prefix incdec notation.
>
>
> **4:** What's that? ++?
>
>
## Which code below equals to `n = n + 1`?
@ -63,13 +54,10 @@ var n int
> **1:** IncDec statement can't be used as an operator.
>
>
> **3:** Go doesn't support prefix incdec notation.
>
>
> **4:** What's that? ++?
>
>
## Which code below equals to `n -= 1`?
@ -80,13 +68,10 @@ var n int
> **1:** IncDec statement can't be used as an operator.
>
>
> **2:** IncDec statement can't be used as an operator. And also, you can't use it with `1--`. The value should be addressable. You're going to learn what that means soon.
>
>
> **4:** Go doesn't support prefix incdec notation.
>
>
## Which code below divides the `length` by 10?
@ -96,13 +81,10 @@ var n int
> **1:** What's that? `//`?
>
>
> **2:** That's right. This equals to: `length = length / 10`
>
>
> **3:** What's that? `//=`?
>
>
## Which code below equals to `x = x % 2`?
@ -112,10 +94,8 @@ var n int
> **1:** This is a division. You need to use the remainder operator.
>
>
> **2:** Close... But, the `%` operator is on the wrong side of the assignment.
>
>
## Which function below converts a string value into a float value?
@ -137,4 +117,3 @@ func ParseFloat(s string, bitSize int) (float64, error)
> **1:** There are no 128-bit floating point values in Go (Actually there are, but they only belong to the compile-time).
>
>

View File

@ -10,10 +10,8 @@
> **1:** Go doesn't interpret the escape sequences in raw string literals.
>
>
> **2:** That's right. Go interprets `\"` as `"` but it doesn't do so for ` \"World\"`.
>
>
## What's the best way to represent the following text in the code?
@ -65,7 +63,6 @@
>
> **4:** You don't need to use escape sequences inside raw string literals.
>
>
## What's the result of the following expression?
@ -80,7 +77,6 @@ len("lovely")
> **2:** Remember! "a" is 1 char. `a` is also 1 char.
>
>
## What's the result of the following expression?
@ -95,16 +91,12 @@ len("very") + len(`\"cool\"`)
> **1:** There are also double-quotes, count them as well.
>
>
> **2:** That's right. Go doesn't interpreted \" in raw string literals.
>
>
> **3:** Remember! "very" is 4 characters. `very` is also 4 characters.
>
>
> **4:** Remember! Go doesn't interpreted \" in raw string literals.
>
>
## What's the result of the following expression?
@ -119,13 +111,10 @@ len("very") + len("\"cool\"")
> **1:** There are also double-quotes, count them as well.
>
>
> **2:** Remember! Go interprets escape sequences in string literals.
>
>
> **4:** That's right. Go does interpret \" in a string literal. So, "\"" means ", which is 1 character.
>
>
## What's the result of the following expression?
@ -144,13 +133,10 @@ len("péripatéticien")
> **1:** Remember! é is 2 bytes long.
>
>
> **2:** An english letter is 1 byte long. However, é is 2 bytes long. So, that makes up 16 bytes. Cool.
>
>
> **3:** You didn't count the double-quotes, did you?
>
>
## How can you find the correct length of the characters in this string literal?
@ -165,13 +151,10 @@ len("péripatéticien")
> **1:** Where are the double-quotes?
>
>
> **2:** This only finds the bytes in a string value.
>
>
> **4:** You're close. But, the package's name is utf8 not unicode/utf8.
>
>
## What's the result of the following expression?
@ -186,10 +169,8 @@ utf8.RuneCountInString("péripatéticien")
> **1:** This is its byte count. `RuneCountInString` counts the runes (codepoints) not the bytes.
>
>
> **2:** That's right. `RuneCountInString` returns the number of runes (codepoints) in a string value.
>
>
## Which package contains string manipulation functions?
@ -213,16 +194,12 @@ strings.Repeat("*x", 3) + "*"
> **1:** You're close but you missed the concatenation at the end.
>
>
> **2:** Look closely.
>
>
> **3:** Wow! You should really watch the lectures again. Sorry.
>
>
> **4:** That's right. Repeat function repeats the given string. And, the concatenation operator combines the strings.
>
>
## What's the result of this expression?
@ -237,13 +214,9 @@ strings.ToUpper("bye bye ") + "see you!"
> **1:** You missed the ToUpper?
>
>
> **2:** You're close but look closely. ToUpper only changes the first part of the string there.
>
>
> **3:** Not even close. Sorry.
>
>
> **4:** Perfect! Good catch! ToUpper only changes the first part of the string there.
>
>

View File

@ -25,7 +25,6 @@
> **3:** 2^8 is 256, so you can represent 256 different states.
>
>
## How many bits 2 bytes contains?
@ -49,16 +48,12 @@ fmt.Printf("%08b = %d", 2)
> **1:** EXPLANATION. Here: 1 is the first digit from the right. So, it is 2^(1 - 1) = 2^0 = 1.
>
>
> **2:** EXPLANATION. Here: 1 is the second digit from the right. So, it is 2^(2 - 1) = 2^1 = 2.
>
>
> **3:** EXPLANATION. Here: 1 is the third digit from the right. So, it is 2^(3 - 1) = 2^2 = 4.
>
>
> **4:** EXPLANATION. Here: 1 is the fourth digit from the right. So, it is 2^(4 - 1) = 2^3 = 8.
>
>
## How many bytes of memory does an int64 value use?
@ -69,7 +64,6 @@ fmt.Printf("%08b = %d", 2)
> **2:** 1 byte is 8 bits and int64 is 64 bits. So, 64/8=8 bytes.
>
>
## How many bytes are needed to store a value of uint32 type?
@ -80,7 +74,6 @@ fmt.Printf("%08b = %d", 2)
> **2:** 1 byte is 8 bits and uint32 is 32 bits. So, 32/8=4 bytes.
>
>
## What's the size of int data type?
@ -90,7 +83,6 @@ fmt.Printf("%08b = %d", 2)
> **1:** That's right. Go can change its size at the compile-time depending on which target machine you're compiling your program into.
>
>
## English letters can be represented by the numbers within the range of: 0-255. For example, 'A' can be 65. Or, 'B' can be 66. So, what's the best data type for storing an English letter?
@ -102,16 +94,12 @@ fmt.Printf("%08b = %d", 2)
> **1:** That's right. A byte can represent 0-255 different values. So, it's a great fit for representing English letters, and numbers.
>
>
> **2:** In practice, you can do it with a rune value. However, rune is 32-bits long and it can store almost every letter in existince. I'm asking for the optimal data type. Try again.
>
>
> **3:** That would be too large for only 255 different numbers.
>
>
> **4:** Float is not the best data type for numbers without fractional parts.
>
>
@ -127,13 +115,10 @@ fmt.Print(letter + 5)
> **2:** Unsigned integers wrap around after their maximum capacity. Uint8's max is 255, so, if 255 + 1 is 0, then 255 + 5 is 4.
>
>
> **3:** You're very close.
>
>
> **4:** Uint8's max capacity is 255. It can't be 260.
>
>
## What does the following code print?
@ -147,7 +132,5 @@ fmt.Print(num - 3)
> **1:** int8's min capacity is -128. It can't be -131.
>
>
> **2:** Signed integers wrap around after their minimum capacity. int8's min is -128, so, if -128 - 1 is 127, then -128 - 3 is 125.
>
>

View File

@ -22,7 +22,6 @@ type Millennium time.Duration
> **1:** That's right. A defined type doesn't get its source type's methods.
>
>
> **2-4:** Actually the defined type gets it from its underlying type.
>
@ -37,10 +36,8 @@ type Millennium time.Duration
>
> **3:** `radius` is a new type, defined using `float32`.
>
>
> **4:** This declares `radius` as an alias to `float32`. So, they become the same types.
>
>
## How to fix the following code?
@ -63,7 +60,6 @@ fmt.Print(village + city)
>
> **4:** That's right. Now, the `city`'s type is Distance in the expression.
>
>
## For the following program which types you might want to declare?
@ -85,10 +81,8 @@ func main() {
> **1:** But a degree value has a floating part. So, using an integer may not the best way.
>
>
> **2:** float64 can represent a degree value.
>
>
> **3-4:** But a degree value has a floating part. So, using an integer may not the best way. Also, there are two different temperature units here: Celsius and Fahrenheit. Isn't it better to create two distinct types?
>
@ -108,13 +102,10 @@ type (
> **1:** That's right. Go's type system is flat. So, the defined type's underlying type is a type with a real structure. int64 is not just a name, it has its own structure, it's a predeclared type.
>
>
> **2:** Duration is just a new type name. It doesn't its own structure.
>
>
> **3:** Century is just a new type name. It doesn't its own structure.
>
>
## Which types do not need to be converted between each other?
@ -127,7 +118,6 @@ type (
> **1:** byte data type is an alias to uint8 data type. So, they don't need conversion between each other. They're the same types.
>
>
## Which types do not need to be converted between each other?
@ -140,4 +130,3 @@ type (
> **3:** rune data type is an alias to int32 data type. So, they don't need conversion between each other. They're the same types.
>
>

View File

@ -18,7 +18,6 @@
> **1:** "C"onst should be just "c"onst.
>
>
## Which code below is correct?
@ -28,13 +27,10 @@
> **1:** `s` not a constant.
>
>
> **2:** `len` function can be used as an initial value to a constant, when the argument to `len` is also a constant.
>
>
> **3:** You cannot call functions while initializing a constant.
>
>
## Which explanation below is correct for the following code?
@ -48,10 +44,8 @@ porsche := speed * 3
> **2:** speed has no type.
>
>
> **3:** A variable cannot be typeless.
>
>
## How to fix the following code?
@ -65,7 +59,6 @@ spell = "Abracadabra"
> **1:** A constant always have to be initialized to a value. And, sometimes the type declaration is not necessary.
>
>
> **2-3:** That's a variable not a constant.
>
@ -100,13 +93,10 @@ fmt.Print(int64(total) * x)
> **1:** Now, the total constant is typeless, so it can be used with the x variable.
>
>
> **2:** There's still a type mismatch. x is int not int64.
>
>
> **3:** total is already int64. No need to convert it again.
>
>
## What are the values of the following constants?
@ -124,4 +114,3 @@ const (
> **3:** iota starts at 0, not 1.
>
>