Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Test cases are done so bad!

It cant be possible that so many test cases which are correct rely on one solution.

For Example in Lesson 2 Type conversion

In the code given in the editor, we have three different variables, namely length, width and area.

To find the value of the area, you have to multiply the length and width values, but they are of different types.

So to do this you will have to convert one of the values to the other type.

The expected value of the area is 12. So please find the area and provide the code on line number 8.

This is also correct code and solves the case:

package main
import "fmt"

func main() {
var length float64 = 3.5
var width int = 4
var area int = width * int(length)

fmt.Println("Area is:",area)
}

What is wrong here??
by

2 Answers

therealbeko
So this is the correct code to pass the exercise:

package main
import "fmt"

func main() {
var length float64 = 3.5
var width int = 4
var area int
area = int(length) * width
fmt.Println("Area is:",area)
}

Why would you not let me do it the other way? You have to add more test cases it is so confusing sometimes
iamabhishek
Sorry! We will work on adding more test cases.

Login / Signup to Answer the Question.