Skip to main content
Golf 4 bytes
Source Link

Julia 10.06, 5349 bytes

~x=rpad("🔵"^ceil(Int,10(0<=x<1 ? x : 1)),1020,"⚪")

Try it online!Try it online!

If the input x falls outside the range [0,1), it's replaced with 1. The value ⌈10x⌉ determines the number of "🔵", and the output is padded to length with "⚪".

Using the ternary operator without spaces is deprecated in Julia 0.7 and disabled in Julia 1.0. The padding length passed to rpad has to be adjusted for Julia 0.6, probably because textwidth was added in Julia 0.7.

Julia 1.0, 53 bytes

~x=rpad("🔵"^ceil(Int,10(0<=x<1 ? x : 1)),10,"⚪")

Try it online!

If the input x falls outside the range [0,1), it's replaced with 1. The value ⌈10x⌉ determines the number of "🔵", and the output is padded to length with "⚪".

Julia 0.6, 49 bytes

~x=rpad("🔵"^ceil(Int,10(0<=x<1?x:1)),20,"⚪")

Try it online!

If the input x falls outside the range [0,1), it's replaced with 1. The value ⌈10x⌉ determines the number of "🔵", and the output is padded to length with "⚪".

Using the ternary operator without spaces is deprecated in Julia 0.7 and disabled in Julia 1.0. The padding length passed to rpad has to be adjusted for Julia 0.6, probably because textwidth was added in Julia 0.7.

Add explanation
Source Link

Julia 1.0, 53 bytes

~x=rpad("🔵"^ceil(Int,10(0<=x<1 ? x : 1)),10,"⚪")

Try it online!

If the input x falls outside the range [0,1), it's replaced with 1. The value ⌈10x⌉ determines the number of "🔵", and the output is padded to length with "⚪".

Julia 1.0, 53 bytes

~x=rpad("🔵"^ceil(Int,10(0<=x<1 ? x : 1)),10,"⚪")

Try it online!

Julia 1.0, 53 bytes

~x=rpad("🔵"^ceil(Int,10(0<=x<1 ? x : 1)),10,"⚪")

Try it online!

If the input x falls outside the range [0,1), it's replaced with 1. The value ⌈10x⌉ determines the number of "🔵", and the output is padded to length with "⚪".

deleted 64 characters in body
Source Link

Julia 1.0, 3853 bytes (non-competing)

~x=rpad("🔵"^ceil(Int,10x10(0<=x<1 ? x : 1)),10,"⚪")

Try it online!

This solution doesn't yet match the out-of-bounds outputs of the original function.Try it online!

Julia 1.0, 38 bytes (non-competing)

~x=rpad("🔵"^ceil(Int,10x),10,"⚪")

Try it online!

This solution doesn't yet match the out-of-bounds outputs of the original function.

Julia 1.0, 53 bytes

~x=rpad("🔵"^ceil(Int,10(0<=x<1 ? x : 1)),10,"⚪")

Try it online!

added 103 characters in body
Source Link
Loading
Source Link
Loading