Skip to content

Instantly share code, notes, and snippets.

@cacapon
Created November 15, 2019 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cacapon/2fa55722f0e71edae5e39d76f4386a3d to your computer and use it in GitHub Desktop.
Save cacapon/2fa55722f0e71edae5e39d76f4386a3d to your computer and use it in GitHub Desktop.
これは何でしょう?
var = [1,30,'fizz','buzz','fizzbuzz',1,3,5,15]
def func():
# 指定の数値その1から指定の数値その2まで繰り返す
for v in range(var[0],var[1]+1):
# vが15だったら
if v % 15 == 0:
print("{}:{}".format(var[5],var[4]))
# vが3だったら
elif v%3==0:
print("{}:{}".format(var[5], var[2]))
# vが5だったら
elif v %5 == 0:
print("{}:{}".format(var[5], var[3]))
else:
print("{}:".format(var[5]))
var[5] = var[5] + 1
func()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment