Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Python Bootcamp: 3.1.x!


Socgreaser
 Share

Recommended Posts

WARNING THIS GUIDE IS FOR INEXPERIENCEd people!

Welcome to Poopyfoot's Python Boot Camp. You will learn the basics of Python here, so lets get to the coding.

I assume you have the following things:

* Python 3.1.x
* Know what IDLE is
* A Brain, jk.
* Be able to read this (Know English)

Lets get down to the coding~~, shall we?~~

First Open Up IDLE by searching Python in your "Home" or whatever.

Ignore this, just go ahead and click File New Window (CTRL+N)

Now, go ahead and save, name it ~~I am an Idiot erhm~~ My First Python Thing

PRINT FUNCTION

I will teach you now, the Ultimate function. Print. Print basically prints text on your screen. Of course you can't just go ahead and write

print lolI I am such a boss at coding yolo swag

Functions have, well, lets call them "rules". Print has a few rules.. Write this

```
print ("Hello world")
```
Print is your function, Hello world is your argument.

Go ahead and press F5, no, it won't refresh, F5 Runs your program (Kind of like debugging in VB)

You should get this:

```

Hello world

```
Now write this:```

print ("Hellow world")

print ("I mean, Hello Python")

print ("I am using you")
```

When you write that, the program reads

```

print ("Hellow world")

```
So it reads

```

Hello World

```

Then it reads: I mean,Hello Python and then I am using you. So what does this mean? Its basically like a list. Try:```

print ("1, 2, Freddy's coming for you,")

print ("3, 4, lock your door,")

print ("5, 6, grab your crucifix,")

print ("7, 8, better stay up late,")

print ("9, 10, never sleep again")
```

So, I think you figured out the Rules "Print" follows. But it doesn't end there! You can also write problems for example, if you write:

```

print (5+5)

```

Then it will show you

```

5

```
But if you write:

```

print ("5+5")

```
It will show you

```

5+5

```

Python has seven basic operations for numbers:

![](http://www1.picturepush.com/photo/a/12666299/640/12666299.png)

So those are basic things you can do with Print. Now if you ever get far with python and you make something really big and release it as open source you will want to add comments, to add coments just put this:

```

print ("Poopyfoot is a boss") #Edit this and I will sue you, for no reason.

```
```

#Edit this and I will sue you, for no reason.

```That's a comment.

INPUTS AND VARIABLES

I will teach you what an Input is! Input basically lets the user write, so for example lets set a question and name it "name", we are using variables here, so put your seatbelt on.

```

name = input ("What is your name?")

```Basically a variable is a small word or letter that is used to carry a piece of information. I will teach you later how to recall them.

Now I'm not going to tell you this every time, but when I show you a program I recommend that you type it in and run it. I learn better when I type it in and you probably do too

Lets recall the variable!

```

print ("It is a pleasure to meet you, " + name)

```

This basically means It is a pleasure to meet you + thenameyouruserwrote

So it should come out like this:

```

It is a pleasure to meet you, NAMEHERE

```
Now, you can also set variables yourself, for example

```

a=10

```The value of your variable can change, since Python reads your program as a list, for example:

```

a=10

print (a)

a= a +10

print (a)

a= a * 2

print (a)

```You will see a=10, but then a=20 and finally a=40.

To set a variable, don't use spaces. Now try this code:

```

name = input("Write your name")

print ("Your name is, " + name + " right?")

name="sucker"

print ("Your new name is " + name + " muahahah!")

```It asks the user to write his name, it sets the variable to his name, so it reads Your name is NAME, then It sets the variable to "sucker" and reads the next print, which is Your name is sucker muauhahah!.

To set your variable as a word, you have to use quotation marks (") or Python will tell you the variable has not been set. You don't need to use " for numbers tho.

–Lesson 1 is DONE-
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...