Python 3, 43 bytes: for w in input().split():print('*'*len(w)) Sample run: > This is an example histogram of word length **** ** ** ******* ********* ** **** ****** (The string below is entered as a literal, rather than as text) > 'example\twith\nweird\rwhite space' ******* **** ***** ********** Bonus: vertical histogram l=[len(x)for x in input().split()] for i in range(len(l)-1,-1,-1):print(''.join(['*'if j>=i else' 'for j in l])) Demo: > This is an example histogram of word length ** ** *...
David Arenburg
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with David
Contact David, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack