Created
December 11, 2017 22:02
-
-
Save RickGriff/d9a2eb01588ecfce7a661b1768f50097 to your computer and use it in GitHub Desktop.
Codewars Challenge 3 - Stringy Strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#write me a function stringy that takes a size and returns a string of alternating '1s' and '0s'. | |
#the string should start with a 1. | |
#a string with size 6 should return :'101010'. | |
#with size 4 should return : '1010'. | |
#with size 12 should return : '101010101010'. | |
#The size will always be positive and will only use whole numbers. | |
#My Solution: | |
def stringy(size) | |
"10" * (size/2) + "1" * (size%2) | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
def stringy(size)
return "10" * int(size/2) + "1" * int(size%2)
Just try