Skip to content

Instantly share code, notes, and snippets.

@dboyliao
Last active February 3, 2020 06:40
Show Gist options
  • Select an option

  • Save dboyliao/02491a8713dfa8df7b1a4bd931ff61ea to your computer and use it in GitHub Desktop.

Select an option

Save dboyliao/02491a8713dfa8df7b1a4bd931ff61ea to your computer and use it in GitHub Desktop.
import sys
def main():
n = int(sys.argv[1])
to_ignore = set([])
nums = [j for j in range(n, 0, -1)]
nums += [j for j in range(2, n + 1)]
for i in range(1, n + 1):
to_print = [str(j) if j not in to_ignore else " " for j in nums]
print(" ".join(to_print))
to_ignore.add(i)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment