Skip to content

Instantly share code, notes, and snippets.

@shogo82148
Created April 21, 2018 06:20
Show Gist options
  • Save shogo82148/1265bdbdbc2050e4adb1c745272ec9c6 to your computer and use it in GitHub Desktop.
Save shogo82148/1265bdbdbc2050e4adb1c745272ec9c6 to your computer and use it in GitHub Desktop.
PerlとPythonのPolyglot
s="""==;
for (1..100) {
if ($_ % 3 == 0 && $_ % 5 == 0) {
print "fizzbuzz";
} elsif ($_ % 3 == 0) {
print "fizz";
} elsif ($_ % 5 == 0) {
print "buzz";
} else {
print $_;
}
print "\n";
}
__END__
"""
for num in range(1, 101):
if num % 3 == 0 and num % 5 == 0:
print("fizzbuzz")
elif num % 3 == 0:
print("bizz")
elif num % 5 == 0:
print("buzz")
else:
print(num)
s="""==;
for (1..100) {
if ($_ % 3 == 0 && $_ % 5 == 0) {
print "fizzbuzz";
} elsif ($_ % 3 == 0) {
print "fizz";
} elsif ($_ % 5 == 0) {
print "buzz";
} else {
print $_;
}
print "\n";
}
__END__
"""
for num in range(1, 101):
if num % 3 == 0 and num % 5 == 0:
print("fizzbuzz")
elif num % 3 == 0:
print("bizz")
elif num % 5 == 0:
print("buzz")
else:
print(num)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment