YouTube2Text

Writing First Python Program | Printing to Console in Python | Python Tutorials for Beginners #lec4 — Transcript

by Jenny's Lectures CS IT · 2,023 words · 277 segments · language en · Watch on YouTube

Full transcript

  1. 0:00so in the series of learning Python
  2. 0:02programming language in the previous
  3. 0:04video we have discussed like how to
  4. 0:06download and install ID for python py
  5. 0:10charm we have installed and python
  6. 0:12interpretor you can say python
  7. 0:153.1.6 we have installed right so now I
  8. 0:18guess you're are all set with your
  9. 0:20laptop you have python you have an ID to
  10. 0:22write your programs right you have that
  11. 0:24interpretor also okay because python is
  12. 0:27an interpreted language so we have
  13. 0:29already
  14. 0:30know downloaded and installed a base
  15. 0:32interpreter for our Python language I
  16. 0:35hope you have done this thing now in
  17. 0:38this video we'll see how to print
  18. 0:41something on Console or you can say we
  19. 0:44will write our first programming Python
  20. 0:47and what usually we do whenever you
  21. 0:49learn a new programming language the
  22. 0:51first program you write is you print
  23. 0:53that classical hello world on output
  24. 0:57screen on the console the same thing we
  25. 0:59will do we print hello world on the
  26. 1:01screen on the console right in Python so
  27. 1:06to print like in C we use which function
  28. 1:09print a function in C++ we use C out to
  29. 1:12print something on the screen in Python
  30. 1:15what we use in Python 3.10
  31. 1:183.x version python 1.x python 2.x python
  32. 1:223.x but python 2.x version they have
  33. 1:25ended the support for python 2.x uh
  34. 1:28version right 2.1 .2 like this now 3.x
  35. 1:34we are working on 3.10 basically the
  36. 1:36recent is
  37. 1:373.1.6 so in this we have a function
  38. 1:40named print this is the function
  39. 1:45print so this we use to print something
  40. 1:48on the console okay now don't need to
  41. 1:51read don't need to write any header file
  42. 1:53or anything or main function or anything
  43. 1:56simply you need to write what print
  44. 2:01whatever you want to print the string or
  45. 2:04you can say the string or whatever
  46. 2:07message you want to print that we will
  47. 2:09put here within these
  48. 2:12parenthesis okay so I want to print
  49. 2:15hello world so simply in double quotes
  50. 2:18I'll write hello
  51. 2:23world that's it no semicolon nothing
  52. 2:26else if you will run this on your output
  53. 2:29screen you will get this program this
  54. 2:31output hello world if you don't print
  55. 2:35anything if simply you write print and
  56. 2:38you click on run on that file suppose I
  57. 2:41have a file the extension of python file
  58. 2:43is py right so we are simply running
  59. 2:47this
  60. 2:48thing empty parenthesis it's okay it
  61. 2:53will run what it will print just a blank
  62. 2:57line okay the nothing would be shown
  63. 3:00just a blank line a cursor would be here
  64. 3:03nothing would be shown if I want if you
  65. 3:06execute two print function then one and
  66. 3:08two two blank line would be shown
  67. 3:10something like this
  68. 3:13right so you can say it will the Sprint
  69. 3:17function will produce an invisible new
  70. 3:21line character new line means add a new
  71. 3:24line so it will produce an invisible new
  72. 3:27line character because of that that new
  73. 3:30line character we see you know a new
  74. 3:35blank line on your screen right I'll
  75. 3:38show you practically also now whatever
  76. 3:40you want to print you just write Within
  77. 3:43These codes we write hello world simply
  78. 3:46write hello world so now let me do some
  79. 3:49experiment with this uh what you have to
  80. 3:52write down this how you can write down
  81. 3:54this thing if you don't put this
  82. 3:57closing uh Cotes what type of error you
  83. 3:59will will get and these things let's
  84. 4:02just do practical on this uh print
  85. 4:04function and see before going to
  86. 4:06practical let me just this this is what
  87. 4:08in Python the syntax is python in Python
  88. 4:113 3.x in Python 2.x the previous uh
  89. 4:15versions print was just a statement it
  90. 4:18was not a function so what we used to
  91. 4:20write in that case print and Hello World
  92. 4:25whatever you need to print you can just
  93. 4:28write down in these quotes so print
  94. 4:30hello world that's it no parenthesis so
  95. 4:33it was considered it was as a statement
  96. 4:36in Python 2.x but here in Python 3 it is
  97. 4:40a function so if you are using python
  98. 4:423.x version right then if you write
  99. 4:46something like this if you don't put
  100. 4:47these parenthesis you will get error
  101. 4:49message syntax error message right in if
  102. 4:53you are using python 2.x version you can
  103. 4:55write down print something like this so
  104. 4:57let's just do practical of this thing so
  105. 4:59we have opened our pip charm IDE and let
  106. 5:03me just first change the color so you
  107. 5:06can go to file if you want to change if
  108. 5:09you're comfortable with this color you
  109. 5:11can go for this but I'm not comfortable
  110. 5:13so go to setting and appearance in
  111. 5:16appearance just theme and I want either
  112. 5:20this this light or window 10 light this
  113. 5:25one so you can go for anyone uh from
  114. 5:29here you can uh set these themes okay so
  115. 5:33now let's change this color and just
  116. 5:36click okay now I guess you can see it
  117. 5:38clearly the code fine now oh we have
  118. 5:42created our first project in the
  119. 5:43previous video and first file first. py
  120. 5:47okay if you want to create another file
  121. 5:49what you have to do in the first project
  122. 5:51on first project just click right click
  123. 5:53new and file and just name your file
  124. 5:57okay so I'm not going to to create in
  125. 6:01the first py only extension is py we are
  126. 6:05printing so okay how to print just use
  127. 6:09this Sprint function
  128. 6:11print fine let me just write down again
  129. 6:14p r i n print and see it is showing you
  130. 6:19this is the you know beauty of this ID
  131. 6:21Auto completion and see the print syntax
  132. 6:24it is showing here you can write down
  133. 6:26this values SCP end file flash whatever
  134. 6:29these things that also one by one we'll
  135. 6:30be discussing but right now just if I
  136. 6:33just click enter it will give me like
  137. 6:37these parenthesis automatically so now
  138. 6:40Within These parenthesis I'm
  139. 6:43adding
  140. 6:45hello
  141. 6:47world okay now let me just run this for
  142. 6:51you first see from here I have to select
  143. 6:54here main file is selected so I am going
  144. 6:57to select current file so current file
  145. 6:59is first. py current file means I'm
  146. 7:02working in this file and let's just or
  147. 7:05you can click in this this is the Run
  148. 7:08button or you can just uh right click
  149. 7:10and this run first click on this okay
  150. 7:15now here it is going to run now and now
  151. 7:18it will print on your screen hello world
  152. 7:20first time you know it is taking some
  153. 7:22time because of the indexing and all so
  154. 7:26see you can see here hello world fine
  155. 7:30if I miss this semicolon this sorry this
  156. 7:34um double quote closing double quote as
  157. 7:38you can see a red red underline means
  158. 7:42there is something wrong there is an
  159. 7:44error okay so this is what you can say
  160. 7:48uh this ID will give you these kind of
  161. 7:51things if you use ID this is you can say
  162. 7:53some features or uh some advantages of
  163. 7:56using ID see missing closing quotes So
  164. 8:00from here only you will come to know
  165. 8:02yeah you have missed quotes or if you
  166. 8:04run this here also you will get see now
  167. 8:07type of error C syntax error syntax
  168. 8:10error it is a syntax error so types of
  169. 8:13error there are many types of error okay
  170. 8:16that also uh with these par with the
  171. 8:19code we will be seeing this is what
  172. 8:21syntax error syntax me means what there
  173. 8:24are some rules to write programs in any
  174. 8:28you know programming langu language and
  175. 8:30those rules are known as syntax if you
  176. 8:32don't follow the
  177. 8:34syntax then it will give syntax error so
  178. 8:38now syntax or you can say like we have
  179. 8:41grammar rules okay same in programming
  180. 8:44language also we have some rules to
  181. 8:46write down these programs so these are
  182. 8:48syntax known as syntax if uh now it is
  183. 8:52syntax error because synex is what in
  184. 8:54print whatever string the message which
  185. 8:58is not a code actually see print is a
  186. 9:00code it will do something it will tell
  187. 9:02The Interpreter to do something but this
  188. 9:04hello world is rather than hello world I
  189. 9:07can write Jenny's lectures I can write
  190. 9:10anything else like you are the best so
  191. 9:13this is what just a message it's not a
  192. 9:15code so other than the code whatever you
  193. 9:18write the message or the string that we
  194. 9:19will put in codes okay single quotes as
  195. 9:23well as double quotes that also we'll
  196. 9:25discuss when to put single code when to
  197. 9:27put double quote okay now right now now
  198. 9:29I'm putting double code because actually
  199. 9:31I am from C and C++ background so uh to
  200. 9:34write down string I used to put the
  201. 9:36string the sequence of characters of
  202. 9:38string in double Cotes okay so now see
  203. 9:42syntax error it will give syntax error
  204. 9:44unterminated string literal hello world
  205. 9:47this is a string literal it is
  206. 9:48unterminated you haven't terminated this
  207. 9:51thing detected at line number one line
  208. 9:53number one this is also a skill to
  209. 9:57identify what is the error type of eror
  210. 10:00in which line and all okay so you have
  211. 10:03to you know learn this thing also
  212. 10:07parall okay now see you can see one
  213. 10:09Arrow here you have started this string
  214. 10:12literal but you haven't terminated here
  215. 10:14in line number one or if you're not
  216. 10:17getting what is the error just simply
  217. 10:20the error syntax error this thing copy
  218. 10:23this thing open your Google paste that
  219. 10:26and just click enter okay or more
  220. 10:30specifically you can write this error in
  221. 10:31Python in whatever programming language
  222. 10:33you are you know practicing you're
  223. 10:37learning so generally first uh you know
  224. 10:39that link would be from stack Overflow
  225. 10:41so there someone has already asked this
  226. 10:43type of questions and you will get many
  227. 10:45answers simple okay so now let's just
  228. 10:49first what you have to do close this now
  229. 10:53see after
  230. 10:54closing this is what syntax highlighting
  231. 10:57also you need to know the Sprint is what
  232. 10:58in Black back the string is what in
  233. 11:02green this Hello World Plus these codes
  234. 11:05in green color okay and if you miss this
  235. 11:08and these uh what you can
  236. 11:11say sorry this Sprint is what in not in
  237. 11:14Black it's in blue and these parenthesis
  238. 11:18are in Black so if you remove this
  239. 11:21double coat from here this parenthesis
  240. 11:23and ending of the par parenthesis this
  241. 11:25is also in green color so there is
  242. 11:26something wrong you can identify okay
  243. 11:30okay now put this one and just run this
  244. 11:34again so it will print now hello world
  245. 11:36whatever you want to print you can print
  246. 11:38now if you don't put this
  247. 11:40parenthesis it will give an error see
  248. 11:43you can see the red underline here again
  249. 11:45okay let me just run this and it will
  250. 11:48give again some error see it is giving
  251. 11:50syntax error missing parenthesis in call
  252. 11:53to print did you mean this print you are
  253. 11:57calling print calling means print is a
  254. 11:59function so we are calling print but
  255. 12:01missing parenthesis missing parenthesis
  256. 12:03because we are using 3o exposion so here
  257. 12:06you have to put these parenthesis
  258. 12:10okay now okay what you need to do blank
  259. 12:14print you can call see blank print also
  260. 12:18you can call it will print nothing but a
  261. 12:21blank line it will call an invisible new
  262. 12:24line uh character so again if I write
  263. 12:28print and
  264. 12:30call you will see two blank new line
  265. 12:33same 3 four five print blank you will
  266. 12:35call these blank line would be increased
  267. 12:38like this I hope now print is clear to
  268. 12:40you now in next video I'll discuss a
  269. 12:44coding exercise with you guys okay so I
  270. 12:47hope every point about print function is
  271. 12:49clear to you guys how to write down your
  272. 12:51first program how to print something on
  273. 12:52Console in Python now in the next video
  274. 12:55we'll see a coding exercise related to
  275. 12:57this print function so I'll see you in
  276. 12:59the next video till then bye-bye take
  277. 13:01care

About this transcript

This page contains the full transcript of Writing First Python Program | Printing to Console in Python | Python Tutorials for Beginners #lec4 by Jenny's Lectures CS IT, generated from the public captions YouTube serves with the video. The transcript has 2,023 words across 277 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.