【问题标题】:Can I increase the decrease value from a for loop in python?我可以增加 python 中 for 循环的减少值吗?
【发布时间】:2022-12-04 12:55:37
【问题描述】:

How do I increase the decrease value every loop in for loop ?. Example: from decrease by -1 -> -2 -> -3, etc.

current code:


for i in range(4,0,-1):
    Dev.step(2)
    if i == 1 or i == 3:
        Dev.turnLeft()
        Dev.step(i)
        Dev.step(-i)
        Dev.turnRight()
    else:
        Dev.turnRight()
        Dev.step(i+4)
        Dev.step(-i-4)
        Dev.turnLeft()

  • You can change the -1 third argument to -2 or -3 etc.

标签: python


【解决方案1】:
猜你喜欢
  • 2012-09-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-09-10
  • 2016-02-18
  • 2012-11-19
  • 1970-01-01
相关资源
最近更新 更多