Hello World Python Shell

Python Basics – Hello, World!

Python Basics on Camp Raincloud’s YouTube Channel

Welcome to Camp Raincloud! So you wanna learn Python? Let’s do it!

Python is really powerful, as you know. So you wanna make your thing talk? of course you do – It’s a robot, or a computer! It’s “Hello, World!” the first thing any programmer should ever learn how to do. If you know how to do it, carry on, if you don’t, watch me!

Check this out! With Python, use the print() statement and just say “Hello, World!” We’re using double quotations here – it doesn’t really matter in this instance but sometimes it does. We’ll run this, it says “Hello, World!” Good Job, man!

print("Hello, World!")

>>>
Hello World!
>>>

The next thing you’re gonna do is learn how to do is assign variables. Well call this variable ‘hello’ and we’ll make it say the same thing – “Hello, World!” (gotta have the grammars.) Now, if we run this program there’s not really a whole lot gonna be happening. We just assigned a variable, we didn’t actually make it do anything. Let’s go back to our friend, the print() statement.

This time, we’re gonna use a lot less typing, and hopefully get the same outcome. So if we print the variable ‘hello,’ what will happen is our robot/computer program will say “Hello, World!”

hello = "Hello, World!"

print(hello)

>>>
Hello, World!
>>>

That’s really great! Why do you care? Well, you care because you want to use Python to make robots or programs or whatever! Let’s say you write a robot just to greet people, right? Literally just to greet whoever. Let’s do this, we’re gonna have two variables. One will be ‘name’, one will be ‘hello’. We changed ‘hello’ and I’ll come back to that in just a little bit. In ‘name’ right now, we’ll do this we’ll do my name. You noticed I added a little whitespace here. We’ll go over that stuff in a second.

So I have Hello comma space RaincloudDev and the reason I did that is because my print() statement is gonna look like this: Print, hello, name. Actually, they have to be concatenated! You can add strings together to do what’s called concatenation in python, or programming, etc. – Python right now. What it will do is ‘add’ these two values together which will look something a lot like this: Boop!

hello = "Hello, "
name = "RaincloudDev"

print(hello + name)

>>>
Hello, RaincloudDev!
>>>

There’s no punctuation at the end, because it’s just variables. You can see that I added this space in here, and that’s picked up by the interpreter right here. The variables are right beside each other when they come out of the system. We could add it here and achieve the same output, I think something a little more conventional might look like this:

So we’ll throw some strings in with these variables inside the print() statement. If we put a comma and an open space right in between, we should get the exact same output. Boom. Then the world’s your oyster!

hello = "Hello"
name = "RaincloudDev"

print(hello + ", " + name)

>>>
Hello, RaincloudDev
>>>

There you go! That’s how you print stuff to the screen!

Just to drive this point home a little bit, let’s try this. Let’s say print ‘hello’ MINUS ‘name,” and we’ll see what happens here. It’s a TypeError, of course. “Unsupported operands for string and string.” The + symbol, when working with strings is specifically.. its not Math. Because, you know:

hello = "Hello"
name = "RaincloudDev"

print(hello - name)

>>>
TypeError: Unsupported operand type(s) for -
: 'str' and 'str'
>>>

Strings aren’t numbers. Even since they have similar letters or whatever, it’s not like MINUS is going to take the letters away you just can not do it.

So don’t do it!

yeah just let me know if you like this stuff, like and subscribe I’d love to make more of it. it’s been a lot of fun to make these little short videos on this stuff. and using these old cameras and gears has been a lot of fun. You wanna see the switch I made, Let me know. if you want me to turn it into a robot? let me know! how about stepper motors on vhs? do somethin about it. let me know!

Leave a Reply

Your email address will not be published. Required fields are marked *