It's taking me so long to finish exervises on repl and it's discouraging.

I was able to finish the 4th assigned exercise for my intro to comp sci class, but it took me around 5-6 hours just to write 10 lines of code. I viewed the instructor solution and found that it only had 5 lines of code.

I am keeping up with the class but the actual coding part is difficult for me. Is this normal in the beggining?