Today, teaching computer programing (coding) at the K-12 level is one of the priority areas of many countries. On the other hand, teachers with different levels of knowledge about computer programming face with questions related to what to teach and how to teach in a wide range of settings. Considering that the educational programs related to computer programming skills for K-12 students may be increased in the future, during the pre-service training of teachers, development of their professional skills to teach computer programming skills should be supported. In this research, the design of an elective course organized to teach computer programming skills to the pre-service teachers (PSTs) in a degree program that trains computer teachers for K-12 classes in Turkey was presented. In addition, the factors affecting the PSTs’ perceptions and their success in that course were investigated. Additionally, PSTs’ opinions about the course and the teaching of coding in K-12 classes were examined. According to the findings of the research, it was determined that the PSTs’ perceptions related to the course differed according to their general self-efficacy, whereas they did not show difference according to their gender, level of knowledge about computer programming, and their self-efficacy related to coding. It was also found that their success in this course did not differ according to their gender, their achievements in previous computer programming courses and their general academic achievement. Besides, the opinions of the PSTs related to the teaching of coding in K-12 classes and about the elective course were positive; however, their opinions about the computer programming environments differed according to the programming environments they experienced. In this article, based on the findings of the research, discussions, and suggestions for future studies regarding the teaching of computer programming at the K-12 level are presented.