How to learn to write code quickly when programming? Let's see ....
If we are talking about print speed, then the simulator is a blind method.
If we are talking about the speed of solving a problem, then we should set the tasks that are necessary for ourselves, for example, write your own accounting for your finances. That is, to solve a practical problem of their own. The more often the solution helps, the more effective the training will be. Choose a simple task that you do every day and try to automate it with code. For example, 3 times a day to send to Telegram the number of unanswered letters in the mail. Further add features, such as a link to the mailbox, a list of email headers, to assess the importance and urgency of the answer. Solve everyday tasks and come understanding of the application of written code.
The very first thing to do, no matter how silly it may sound, is to learn to type text quickly on the keyboard. Since most programming languages
use Latin letters, we need to be able to type quickly in the English layout. The fastest way to type text on the keyboard is the so-called “touch typing method”. It lies in the fact that you are not looking at the keyboard, but at the screen, but at each finger of your hand “fixed” a certain area on the keyboard, the keys of which you press only with this finger. There are different lessons and simulators, both paid and free, which help to consolidate the typing skill and to remember the location of the keys on a subconscious level.
The next stage is a good understanding of the programming language, its syntax and semantics. It will also be good to know the functions and structures that you often use in your work. How can you improve your knowledge of the language and its structures? You can constantly read the documentation, but it's boring and not so interesting. It is much better to study ready-made code samples, for example, the source code of your favorite framework or applications created by other developers and uploaded to open sources, for example on GitHub.
But reading the code is not enough, you need to practice practicing its change / addition. After all, no one forbids you to copy the code of an application or algorithm from the Internet and modify it, and then run and see how the program works with your changes. Thus, you are not just learning the code, but also experimenting with it, and, of course, you better remember the features of your programming language.
You also need to get used to the program in which you are writing code. For example, a code editor or development environment (IDE). Most of them contain many useful features, snippets, keyboard shortcuts, plug-ins, the purpose of which is to accelerate the development of programs. But for this you need to get comfortable with them and explore the features you need.
Along with studying your code editor, I strongly recommend learning how to use a debugger. Unfortunately, most novice developers neglect debuggers, believing that they are difficult to configure and it is much easier to simply output the contents of the variable to the console, which probably caused an error. But the debugger allows you to walk through your code line by line, while studying the contents of all variables, or jump to a breakpoint and immediately examine the structure you are interested in. It may seem difficult, but in fact, debuggers save a lot of time searching for bugs.
And of course practice, a lot of practice - nobody will replace it.