Skip to content

Commit 4e666b2

Browse files
authored
Merge pull request #80 from codingthat/update-resistor-color-trio-godot-4.4.1
Update `resistor-color-trio` example to pass on Godot Engine v4.4.1
2 parents 8d20737 + 362658d commit 4e666b2

File tree

1 file changed

+5
-2
lines changed
  • exercises/practice/resistor-color-trio/.meta

1 file changed

+5
-2
lines changed

exercises/practice/resistor-color-trio/.meta/example.gd

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ func color_code(colors):
1313

1414
for key in units.keys():
1515
if total >= key:
16-
return str(total / key) + " " + units[key]
16+
return format_number(total / key) + " " + units[key]
1717

18-
return str(total) + " ohms"
18+
return format_number(total) + " ohms"
19+
20+
func format_number(n):
21+
return str(int(n)) if n == int(n) else str(n)

0 commit comments

Comments
 (0)