Ask coding questions

← Back to all posts
how to make 100 coins to be taken and in return given 1 ingot of gold
Agzamikail (2)

how to make 100 coins to be taken and in return given 1 ingot of gold

Comments
hotnewtop
LukeWright (114)

if coins and ingots are both integers then you could just

if coins % 100 == 0:
  ingots = coins / 100
elif coins % 100 != 0:
  ingots = round(coins / 100)
Agzamikail (2)

File "main.py", line 43
ingots = round(coins / 100) if coins % 100 == 0:
^
SyntaxError: invalid syntax

@LukeWright

LukeWright (114)

delete lines 44,45, and 46,
and change line 43 to just

ingots = round(coins / 100)

I think when you copied and pasted it, you pasted it twice instead of once
@Agzamikail