paint-brush
Python for Beginners, Part 2: Hello World Exerciseby@cleverprogrammer
378 reads
378 reads

Python for Beginners, Part 2: Hello World Exercise

by Clever ProgrammerDecember 7th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Python is free for Python beginners, and it's free to use it for beginners. The first exercise is a basic 'hello world' exercise. Python is not listening to you. You write out your entire whatever you want to write, then you send it over to Python, and then Python responds to all of that. You're almost having a conversation with Python. It's almost like you're sending an Email to Python and Python is sitting there, and once it sees your Email it'll type stuff back to you.

Company Mentioned

Mention Thumbnail
featured image - Python for Beginners, Part 2: Hello World Exercise
Clever Programmer HackerNoon profile picture

We cover the most basic 'hello world' exercise! This will be fun and now you are on your way to an exciting journey!

See also:

Transcirpt

00:00 Okay guys, back to where we left off.

00:02 So, we just did some simple stuff in Python,

00:06 right, we can print stuff by doing this.

00:09 And then it prints it out to the screen.

00:11 That's cool.00:13Now, what we wanna do is we want to take it

00:15 to a little bit of a next level.

00:17 I want you to come up here and select "New File."

00:22 This brings up this file, here.

00:25 Let's go back to our other screen.

00:28 And let us simply put this to the right side.

00:33 Let's put this to the left side.

00:36 And, what I wanna do is I want to write a few things here,

00:39 like "print hello,"

00:42 "print monkeys eat bananas all the time."

00:50 And then I want to say-

00:53 And notice how I'm putting these quotes.

00:55 We will learn a little bit more about that later.

00:57 And then I can say "print five times 25."

01:02 Okay.

01:06 And I am gonna run this.

01:08 So I'm gonna save this first.

01:11 You can save it anywhere you would like.

01:14 Let's, for our purposes, let's save it in our desktop.

01:18 Or, let's do one better and let's go here

01:22 and let's call this "practice exercises"

01:26 and we will save it in here, printing.

01:31 And I'm going to go to "Run" and hit "Python Shell."

01:37 And here you're going to see what happens.

01:38 I'm gonna say "Run" and actually "run module."

01:41 So I'm going to say "run module."

01:42 That just means run this whole thing that we just wrote.

01:45 So let's run it, let's check out what happens.

01:48 Boom.

01:49 On the left hand side, it ran our entire file.

01:52 On the left hand side,

01:54 everything you type in

01:55 (keyboard clicking)

01:58 gives you the result right away.

01:59 So you can write four times eight, 20 times 6,

02:03 but on the right hand side,

02:05 notice when I press enter nothing happens.

02:07 So, you're kind of writing a story here,

02:10 that's how I like to think of it.

02:12 You're writing kind of a novel.

02:13 And this is almost you having a conversation with Python.

02:17 You're like, "Hey Python, what's up?"

02:19 or in Python's language, eight times eight.

02:23 And Python is like "64."

02:25 Here, Python is not listening to you.

02:27 You write out your entire whatever you want to write,

02:30 and then you send it over to Python,

02:32 and then Python responds to all of that.

02:36 Almost like you're sending an Email to Python

02:39 and Python is sitting there,

02:40 and once it sees your Email it'll type stuff back to you.

02:45 Okay, let's run it again just to check what happens.

02:48 And I will run, and you can see that it runs

02:51 all of that at the same time.

02:54 So, what I wanna do is

02:57 I wanna give you guys a little problem.

02:59 And the problem is: How would you print

03:01 "Hello World?"

03:03 And I want to be able to test this for you guys.

03:06 So what I have done is I have set up something kind of cool.

03:10 I want you to go on,

03:12 open a new tab,

03:14 I want you to go to

03:14 clever programmer dot com.

03:16 And once you're here,

03:18 I want you to click on "learn Python for beginners."

03:21 Notice that it's free.

03:23 So, simply go to that.

03:25 And here I've put together a little exercise for you guys.

03:28 So, once you start this course,

03:30 you can feel free to watch all of this on YouTube,

03:33 it's available for free.

03:35 If you want, you can also go to my website.

03:39 And here it'll give you a little progress bar and everything,

03:42 you can comment and I can respond to you as well.

03:44 And here, this is where I'll also put

03:46 all of the exercises.

03:48 So if you guys want to follow along this course

03:50 and do the exercises, this is where you can come

03:52 and find them.

03:53 So let's click exercise one and start.

03:56 Now, notice you have a quiz here.

03:58 It says "How do you print out "Hello, World!"

04:01 So, I'm now going to answer that for you here.

04:04 Although I'm sure you can figure out.

04:06 And we want it to look exactly like this in Python 3.

04:10 Just a little bit about Python 3 versus Python 2,

04:13 is if you do this in Python 3,

04:17 you're gonna get an error.

04:18 So, let's just try it out on the left hand side.

04:20 Let's say "print 10."

04:23 You can see that we get an error.

04:25 And if I do "print 10"

04:27 I don't get an error.

04:29 So in Python 3, this is the correct way of doing it.

04:31 In Python 2, you can do it just like this

04:35 and it actually will not give you an error, okay?

04:37 Just something for you to know.

04:39 So here, I want you to select the correct answer.

04:42 And another thing I made for you guys is

04:44 if you click this link,

04:48 what I've put together is so simple.

04:52 You'll have to sign up, it'll be really short.

04:55 And once you're done doing that, just click on

04:56 exercise one.

04:57 And on the right hand side,

04:59 you see that I want you to print out "Hello, World!"

05:03 Alright, so now that you're here,

05:05 let's type in something like "print 25 times 63"

05:10 and let's run it.

05:12 It gives me 1575.

05:13 Great, let's hit submit.

05:14 Let's see what happens.

05:16 Oh, whoops.

05:17 It says "Output mismatch" and you've failed

05:20 to answer it correctly.

05:24 So you can click "What's wrong?"

05:26 and it'll kind of tell you what the answer is,

05:28 or you can hit submit anyway,

05:30 and then it might also tell you what the answer is.

05:32 But, I want you to try to figure it out.

05:34 And I'm sure you probably already have.

05:36 So I'm not going to tell you what the answer is,

05:38 but once you write the correct answer,

05:40 it'll give you a little green thumbs up

05:41and say "Hey, good job, you got it."

05:43 So now I want you try it,05:46and I'll see you in the next video.