Writing First Python Program | Printing to Console in Python | Python Tutorials for Beginners #lec4 — Transcript
Full transcript
- 0:00so in the series of learning Python
- 0:02programming language in the previous
- 0:04video we have discussed like how to
- 0:06download and install ID for python py
- 0:10charm we have installed and python
- 0:12interpretor you can say python
- 0:153.1.6 we have installed right so now I
- 0:18guess you're are all set with your
- 0:20laptop you have python you have an ID to
- 0:22write your programs right you have that
- 0:24interpretor also okay because python is
- 0:27an interpreted language so we have
- 0:29already
- 0:30know downloaded and installed a base
- 0:32interpreter for our Python language I
- 0:35hope you have done this thing now in
- 0:38this video we'll see how to print
- 0:41something on Console or you can say we
- 0:44will write our first programming Python
- 0:47and what usually we do whenever you
- 0:49learn a new programming language the
- 0:51first program you write is you print
- 0:53that classical hello world on output
- 0:57screen on the console the same thing we
- 0:59will do we print hello world on the
- 1:01screen on the console right in Python so
- 1:06to print like in C we use which function
- 1:09print a function in C++ we use C out to
- 1:12print something on the screen in Python
- 1:15what we use in Python 3.10
- 1:183.x version python 1.x python 2.x python
- 1:223.x but python 2.x version they have
- 1:25ended the support for python 2.x uh
- 1:28version right 2.1 .2 like this now 3.x
- 1:34we are working on 3.10 basically the
- 1:36recent is
- 1:373.1.6 so in this we have a function
- 1:40named print this is the function
- 1:45print so this we use to print something
- 1:48on the console okay now don't need to
- 1:51read don't need to write any header file
- 1:53or anything or main function or anything
- 1:56simply you need to write what print
- 2:01whatever you want to print the string or
- 2:04you can say the string or whatever
- 2:07message you want to print that we will
- 2:09put here within these
- 2:12parenthesis okay so I want to print
- 2:15hello world so simply in double quotes
- 2:18I'll write hello
- 2:23world that's it no semicolon nothing
- 2:26else if you will run this on your output
- 2:29screen you will get this program this
- 2:31output hello world if you don't print
- 2:35anything if simply you write print and
- 2:38you click on run on that file suppose I
- 2:41have a file the extension of python file
- 2:43is py right so we are simply running
- 2:47this
- 2:48thing empty parenthesis it's okay it
- 2:53will run what it will print just a blank
- 2:57line okay the nothing would be shown
- 3:00just a blank line a cursor would be here
- 3:03nothing would be shown if I want if you
- 3:06execute two print function then one and
- 3:08two two blank line would be shown
- 3:10something like this
- 3:13right so you can say it will the Sprint
- 3:17function will produce an invisible new
- 3:21line character new line means add a new
- 3:24line so it will produce an invisible new
- 3:27line character because of that that new
- 3:30line character we see you know a new
- 3:35blank line on your screen right I'll
- 3:38show you practically also now whatever
- 3:40you want to print you just write Within
- 3:43These codes we write hello world simply
- 3:46write hello world so now let me do some
- 3:49experiment with this uh what you have to
- 3:52write down this how you can write down
- 3:54this thing if you don't put this
- 3:57closing uh Cotes what type of error you
- 3:59will will get and these things let's
- 4:02just do practical on this uh print
- 4:04function and see before going to
- 4:06practical let me just this this is what
- 4:08in Python the syntax is python in Python
- 4:113 3.x in Python 2.x the previous uh
- 4:15versions print was just a statement it
- 4:18was not a function so what we used to
- 4:20write in that case print and Hello World
- 4:25whatever you need to print you can just
- 4:28write down in these quotes so print
- 4:30hello world that's it no parenthesis so
- 4:33it was considered it was as a statement
- 4:36in Python 2.x but here in Python 3 it is
- 4:40a function so if you are using python
- 4:423.x version right then if you write
- 4:46something like this if you don't put
- 4:47these parenthesis you will get error
- 4:49message syntax error message right in if
- 4:53you are using python 2.x version you can
- 4:55write down print something like this so
- 4:57let's just do practical of this thing so
- 4:59we have opened our pip charm IDE and let
- 5:03me just first change the color so you
- 5:06can go to file if you want to change if
- 5:09you're comfortable with this color you
- 5:11can go for this but I'm not comfortable
- 5:13so go to setting and appearance in
- 5:16appearance just theme and I want either
- 5:20this this light or window 10 light this
- 5:25one so you can go for anyone uh from
- 5:29here you can uh set these themes okay so
- 5:33now let's change this color and just
- 5:36click okay now I guess you can see it
- 5:38clearly the code fine now oh we have
- 5:42created our first project in the
- 5:43previous video and first file first. py
- 5:47okay if you want to create another file
- 5:49what you have to do in the first project
- 5:51on first project just click right click
- 5:53new and file and just name your file
- 5:57okay so I'm not going to to create in
- 6:01the first py only extension is py we are
- 6:05printing so okay how to print just use
- 6:09this Sprint function
- 6:11print fine let me just write down again
- 6:14p r i n print and see it is showing you
- 6:19this is the you know beauty of this ID
- 6:21Auto completion and see the print syntax
- 6:24it is showing here you can write down
- 6:26this values SCP end file flash whatever
- 6:29these things that also one by one we'll
- 6:30be discussing but right now just if I
- 6:33just click enter it will give me like
- 6:37these parenthesis automatically so now
- 6:40Within These parenthesis I'm
- 6:43adding
- 6:45hello
- 6:47world okay now let me just run this for
- 6:51you first see from here I have to select
- 6:54here main file is selected so I am going
- 6:57to select current file so current file
- 6:59is first. py current file means I'm
- 7:02working in this file and let's just or
- 7:05you can click in this this is the Run
- 7:08button or you can just uh right click
- 7:10and this run first click on this okay
- 7:15now here it is going to run now and now
- 7:18it will print on your screen hello world
- 7:20first time you know it is taking some
- 7:22time because of the indexing and all so
- 7:26see you can see here hello world fine
- 7:30if I miss this semicolon this sorry this
- 7:34um double quote closing double quote as
- 7:38you can see a red red underline means
- 7:42there is something wrong there is an
- 7:44error okay so this is what you can say
- 7:48uh this ID will give you these kind of
- 7:51things if you use ID this is you can say
- 7:53some features or uh some advantages of
- 7:56using ID see missing closing quotes So
- 8:00from here only you will come to know
- 8:02yeah you have missed quotes or if you
- 8:04run this here also you will get see now
- 8:07type of error C syntax error syntax
- 8:10error it is a syntax error so types of
- 8:13error there are many types of error okay
- 8:16that also uh with these par with the
- 8:19code we will be seeing this is what
- 8:21syntax error syntax me means what there
- 8:24are some rules to write programs in any
- 8:28you know programming langu language and
- 8:30those rules are known as syntax if you
- 8:32don't follow the
- 8:34syntax then it will give syntax error so
- 8:38now syntax or you can say like we have
- 8:41grammar rules okay same in programming
- 8:44language also we have some rules to
- 8:46write down these programs so these are
- 8:48syntax known as syntax if uh now it is
- 8:52syntax error because synex is what in
- 8:54print whatever string the message which
- 8:58is not a code actually see print is a
- 9:00code it will do something it will tell
- 9:02The Interpreter to do something but this
- 9:04hello world is rather than hello world I
- 9:07can write Jenny's lectures I can write
- 9:10anything else like you are the best so
- 9:13this is what just a message it's not a
- 9:15code so other than the code whatever you
- 9:18write the message or the string that we
- 9:19will put in codes okay single quotes as
- 9:23well as double quotes that also we'll
- 9:25discuss when to put single code when to
- 9:27put double quote okay now right now now
- 9:29I'm putting double code because actually
- 9:31I am from C and C++ background so uh to
- 9:34write down string I used to put the
- 9:36string the sequence of characters of
- 9:38string in double Cotes okay so now see
- 9:42syntax error it will give syntax error
- 9:44unterminated string literal hello world
- 9:47this is a string literal it is
- 9:48unterminated you haven't terminated this
- 9:51thing detected at line number one line
- 9:53number one this is also a skill to
- 9:57identify what is the error type of eror
- 10:00in which line and all okay so you have
- 10:03to you know learn this thing also
- 10:07parall okay now see you can see one
- 10:09Arrow here you have started this string
- 10:12literal but you haven't terminated here
- 10:14in line number one or if you're not
- 10:17getting what is the error just simply
- 10:20the error syntax error this thing copy
- 10:23this thing open your Google paste that
- 10:26and just click enter okay or more
- 10:30specifically you can write this error in
- 10:31Python in whatever programming language
- 10:33you are you know practicing you're
- 10:37learning so generally first uh you know
- 10:39that link would be from stack Overflow
- 10:41so there someone has already asked this
- 10:43type of questions and you will get many
- 10:45answers simple okay so now let's just
- 10:49first what you have to do close this now
- 10:53see after
- 10:54closing this is what syntax highlighting
- 10:57also you need to know the Sprint is what
- 10:58in Black back the string is what in
- 11:02green this Hello World Plus these codes
- 11:05in green color okay and if you miss this
- 11:08and these uh what you can
- 11:11say sorry this Sprint is what in not in
- 11:14Black it's in blue and these parenthesis
- 11:18are in Black so if you remove this
- 11:21double coat from here this parenthesis
- 11:23and ending of the par parenthesis this
- 11:25is also in green color so there is
- 11:26something wrong you can identify okay
- 11:30okay now put this one and just run this
- 11:34again so it will print now hello world
- 11:36whatever you want to print you can print
- 11:38now if you don't put this
- 11:40parenthesis it will give an error see
- 11:43you can see the red underline here again
- 11:45okay let me just run this and it will
- 11:48give again some error see it is giving
- 11:50syntax error missing parenthesis in call
- 11:53to print did you mean this print you are
- 11:57calling print calling means print is a
- 11:59function so we are calling print but
- 12:01missing parenthesis missing parenthesis
- 12:03because we are using 3o exposion so here
- 12:06you have to put these parenthesis
- 12:10okay now okay what you need to do blank
- 12:14print you can call see blank print also
- 12:18you can call it will print nothing but a
- 12:21blank line it will call an invisible new
- 12:24line uh character so again if I write
- 12:28print and
- 12:30call you will see two blank new line
- 12:33same 3 four five print blank you will
- 12:35call these blank line would be increased
- 12:38like this I hope now print is clear to
- 12:40you now in next video I'll discuss a
- 12:44coding exercise with you guys okay so I
- 12:47hope every point about print function is
- 12:49clear to you guys how to write down your
- 12:51first program how to print something on
- 12:52Console in Python now in the next video
- 12:55we'll see a coding exercise related to
- 12:57this print function so I'll see you in
- 12:59the next video till then bye-bye take
- 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.