C to python code snippet
C code can be easily translated into Python code. However, the difference in syntax can make this process tedious and time-consuming. Can Vim help you here?
Start file
const wc_units_data wc_units_frequency[]= { {"mHz", 1e-3}, {"Hz", 1.0}, {"kHz", 1e3}, {"MHz", 1e6}, {"GHz", 1e9}, {NULL,0} };
End file
def wc_units_frequency(): return {"mHz": 1e-3, "Hz": 1.0, "kHz": 1e3, "MHz": 1e6, "GHz": 1e9, "NULL": 0}
View Diff
1,9c1,7 < const wc_units_data wc_units_frequency[]= < { < {"mHz", 1e-3}, < {"Hz", 1.0}, < {"kHz", 1e3}, < {"MHz", 1e6}, < {"GHz", 1e9}, < {NULL,0} < }; --- > def wc_units_frequency(): > return {"mHz": 1e-3, > "Hz": 1.0, > "kHz": 1e3, > "MHz": 1e6, > "GHz": 1e9, > "NULL": 0}
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 29 remaining solutions by signing in and submitting your own entry
#30 fufuror / @futachima - Score: 228 - 01/25/23 @ 17:25
5xidef<Esc>lldw/[xx<BS><BS><CR>xxi()<Esc>lr:<Esc>jxi<Tab><BS> return <BS> <Esc>jllllllxjhxjlxjxjxjhhhhhhhxkxkxkxkxkxlllllr:jhr:jlr:jr:jr:jh:<Esc><C-G>r:<Esc>kkkkkkkjlla{<Del><Del><Del><Del><Del><Del>"<Esc>j0i <Esc>j0i8<BS><Esc>8i <Esc>i <BS><BS><BS><Esc>joi <Esc>u0i <Esc>j0i <Esc>j0i <Esc>llllli"<Esc>lllla"<Esc>la <Esc>jddZZ
0 comments