Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/sbin/env python
# -*- coding: utf-8 -*-
# Fizz_Buzz
from __future__ import print_function
print("easy ver\n")
for i in range(1, 101):
if i % 15 == 0:
print("fizzbuzz")
elif i % 3 == 0:
print("fizz")
elif i % 5 == 0:
print("buzz")
else:
print(i)
print("\n2行er\n")
for i in range(1, 101):
(print("fizzbuzz")) if (i % 15 == 0) else ((print("fizz")) if (i % 3 == 0) else ((print("buzz")) if (i % 5 == 0) else(print(i))))
print("\nリスト内包表記を使った1行ver\n")
print([("fizzbuzz") if (i % 15 == 0) else (("fizz") if (i % 3 == 0) else (("buzz") if (i % 5 == 0) else(i))) for i in range(1, 101)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment