ブリブリ備忘録 おっ、python

HackerRankの問題とコメント(python3) 拙いですが...

2018-09-12から1日間の記事一覧

String Formatting

・問題 Given an integer, , print the following values for each integer from to : Decimal Octal Hexadecimal (capitalized) Binary The four values must be printed on a single line in the order specified above for each from to . Each value sho…

Designer Door Mat

・問題 Mr. Vincent works in a door mat manufacturing company. One day, he designed a new door mat with the following specifications: Mat size must be X. ( is an odd natural number, and is times .) The design should have 'WELCOME' written i…

Text Wrap

・問題 You are given a string and width . Your task is to wrap the string into a paragraph of width . Input Format The first line contains a string, . The second line contains the width, . Constraints Output Format Print the text wrapped p…

Text Alignment

・問題 In Python, a string of text can be aligned left, right and center. .ljust(width) This method returns a left aligned string of length width. >>> width = 20 >>> print 'HackerRank'.ljust(width,'-') HackerRank---------- .center(width) T…