Python challenge
Change the types of the variables in the list from str to float, while keeping the truncation.
Start file
a = ['%.3f' % 3.5313423, '%.1f' % 35.66] b = ['%.3f' % 3.90022, '%.1f' % 95.501033] c = ['%.5f' % self.numbers[2]]
End file
a = [round(3.5313423, 3), round(35.66, 1)] b = [round(3.90022, 3), round(95.501033, 1)] c = [round(self.numbers[2], 5)]
View Diff
1,3c1,3 < a = ['%.3f' % 3.5313423, '%.1f' % 35.66] < b = ['%.3f' % 3.90022, '%.1f' % 95.501033] < c = ['%.5f' % self.numbers[2]] --- > a = [round(3.5313423, 3), round(35.66, 1)] > b = [round(3.90022, 3), round(95.501033, 1)] > c = [round(self.numbers[2], 5)]
Solutions
The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!
Check out these helpful resources to improve your Vim skills... Game on.
Unlock 45 remaining solutions by signing in and submitting your own entry
#46 Dany Alexander Caro Saavedra / @DanyAlexanderC7 - Score: 138 - 12/28/18 @ 21:03
f'qa2dWiround(W<C-H><Esc>W3<Esc>i3)q<C-H><Esc>ql@axhxkllllllllllllllllllllllll hi <Esc>lllllllllllli, 1)<Esc>j^f'@aa,<Esc>kla,<Esc>jh@a<C-H><C-H>jkFri <Esc>2f3a, 1)<Esc>j^xx?<Esc><Esc>f'@ai<C-H><Esc>a, 5<Esc>ZZ
0 comments