def commands_arduino(a,b): # a: command, b: times
# Old - '%04d' % (42,)
# New - '{:04d}'.format(42)
# Output - 0042
commands = "".join(a for i in range(b))
if a == 'a': # left
result = 'a{:03d}'.format(round((5.625 * b)))
elif a == 'd': # right
result = 'd{:03d}'.format(round((5.625 * b)))
elif a == 'w': # forward
result = 'w{:03d}'.format(round(0.53125 * b))
elif a == 'x': # backward
result = 'x{:03d}'.format(round(0.53125 * b))
else:
result = 'quit'
return commands, result
위 코드에서 commandes
에 무엇을 넣는다는건지
a{:03d}
가 의미하는것과 format
이 정확히 무엇인지 알려주시면 감사하겠습니다!