Alan is known for referring to the temperature of the apple turnover as 'Hotter than the sun!'. According to space.com the temperature of the sun's corona is 2,000,000 degrees C, but we will ignore the science for now.
Your job is simple, if (x) squared is more than 1000, return 'It's hotter than the sun!!', else, return 'Help yourself to a honeycomb Yorkie for the glovebox.'.
X will be a valid integer number.
X will be either a number or a string. Both are valid.
내 답 :
String apple(dynamic a) => math.pow(int.parse("$a"), 2) > 1000 ? "It's hotter than the sun!!" : 'Help yourself to a honeycomb Yorkie for the glovebox.';
String apple(dynamic a) => int.parse('$a') * int.parse('$a') > 1000 ?
"It's hotter than the sun!!" : 'Help yourself to a honeycomb Yorkie for the glovebox.';
String apple(dynamic a) {
final n = a is int ? a : int.parse(a);
if (n*n > 1000) return "It's hotter than the sun!!";
return "Help yourself to a honeycomb Yorkie for the glovebox.";
}
String apple(dynamic a) {
int b = int.tryParse(a.toString());
//print(b);
if (b * b > 1000){
return ("It's hotter than the sun!!");
} else {
return ('Help yourself to a honeycomb Yorkie for the glovebox.');
}
}
import 'dart:math' as math;
String apple(dynamic a) {
return math.pow(int.parse(a.toString()), 2) > 1000
? "It's hotter than the sun!!"
: "Help yourself to a honeycomb Yorkie for the glovebox.";
}