Skip to content
← Back to Community
[1] Python Made EZ! 🐍
Profile icon
Bookie0

Hîïíīįì everyone!

Hope y'all are doing great! School is starting real soon, so I hope you have been studying to get ready you are enjoying the last of vacation!

So I made this tutorial on python so that others can try to learn from it and get better! Hopefully, what I say will be comprehensive and easy to read.

Most of it I will write, but sometimes I will include some stuff from other websites which explain better than me. I will put what I've taken in italic, and the sources and helpful links at the bottom.

By the way, this is the first of tutorials in languages I'm making!


I will be covering:

  • Hello World!: History of Python
  • Key Terms
  • Comments
  • print
  • Data Types
  • Variables
    • Printing Variables
    • Naming Variables
    • Changing Variables
  • Concatenation
  • Operators
  • Comparison Operators
  • Conditionals
    • if
    • elif
    • else
  • input
  • A Bit of Lists
  • for Loops
  • while Loops
  • Functions
  • Imports
    • time
    • random
    • math
  • Small Programs and Useful Stuff
  • ANSI Escape Codes
  • Links
  • Goodbye World!: End

Well without any further ado, let's get on with it!


Hello World!: History of Python

Python is a general purpose programming language. It was created by Guido Van Rossum and released in 1991. One of the main features of it is its readability, simple syntax, and few keywords, which makes it great for beginners (with no prior experience of coding) to learn it.

Fun fact: Guido Van Rossum was reading the scripts of Monty Python when he was creating the language; he needed "a name that was short, unique, and slightly mysterious" so he decided to call the language Python.

(Last year we had to make a poem on a important person in Computer Science, so I made one on him: https://docs.google.com/document/d/1yf2T2fFaS3Vwk7zkvN1nPOr8XPXJroL1yHI7z5qhaRc/edit?usp=sharing)


Key Terms

Now before we continue, just a few words you should know:

  • Console: The black part located at the right/bottom of your screen

Screen Shot 2020-08-31 at 8.23.50 AM

  • Input: stuff that is taken in by the computer (more on this later)

  • Ouput: the information processed and sent out by the computer (usually in the console)

Screen Shot 2020-08-31 at 8.26.49 AM

  • Errors: actually, a good thing! Don't worry if you have an error, just try to learn from it and correct it. That's how you can improve, by knowing how to correct errors.

  • Execute: run a piece of code


Comments

Comments are used for explaining your code, making it more readable, and to prevent execution when testing code.

This is how to comment:

# this is a comment # it starts with a hashtag # # Python will ignore and not run anything after the hashtag

You can also have multiline comments:

""" this is a multiline comment I can make it very long! """

print

The print() functions is used for outputting a message (object) onto the console. This is how you use it:

print("Something.") # remember this is a comment # you can use double quotes " # or single quotes ' print('Using single quotes') print("Is the same as using double quotes")

You can also triple quotes for big messages.

Example:

print("Hello World!") print(""" Rules: [1] Code [2] Be nice [3] Lol [4] Repeat """)

Output:

Hello World! Rules: [1] Code [2] Be nice [3] Lol [4] Repeat

Data Types

Data types are the classification or categorization of data items.

These are the 4 main data types:

int: (integer) a whole number
12 is an int, so is 902.

str: (string) a sequence of characters
"Hi" is a str, so is "New York City".

float: (float) a decimal
-90 is a float, so is 128.84

bool: (boolean) data type with 2 possible values; True and False
Note that True has a capital T and False has a capital F!


Variables

Variables are used for containing/storing information.

Example:

name = "Lucy" # this variable contains a str age = 25 # this variable contains an int height = 160.5 # this variable contains a float can_vote = True # this variable contains a Boolean that is True (because Lucy is 25 y/o)

Printing variables:

To print variables, you simply do print(variableName):

print(name) print(age) print(height) print(can_vote)

Output:

Lucy 25 160.5 True

Naming Variables:

You should try to make variables with a descriptive name. For example, if you have a variable with an age, an appropriate name would be age, not how_old or number_years.

Some rules for naming variables:

  • must start with a letter (not a number)
  • no spaces (use underscores)
  • no keywords (like print, input, or, etc.)

Changing Variables:

You can change variables to other values.

For example:

x = 18 print(x) x = 19 print(x) # the output will be: # 18 # 19

As you can see, we have changed the variable x from the initial value of 18 to 19.


Concatenation

Let's go back to our first 3 variables:

name = "Lucy" age = 25 height = 160.5

What if we want to make a sentence like this:
Her name is Lucy, she is 25 years old and she measures 160.5 cm.

Of course, we could just print that whole thing like this:
print("Her name is Lucy, she is 25 years old and she measures 160.5 cm.")

But if we want to do this with variables, we could do it something like this:

print("Her name is " + name + ", she is " + age + " years old and she measures " + height + " cm.") # try running this!

Aha! If you ran it, you should have gotten this error:

Screen Shot 2020-08-31 at 9.27.22 AM

Basically, it means that you cannot concatenate int to str. But what does concatenate mean?

Concatenate means join/link together, like the concatenation of "sand" and "castle" is "sandcastle"

In the previous code, we want to concatenate the bits of sentences ("Her name is ", ", she is", etc.) as well as the variables (name, age, and height).

Since the computer can only concatenate str together, we simply have to convert those variables into str, like so:

print("Her name is " + name + ", she is " + str(age) + " years old and she measures " + str(height) + " cm.") # since name is already a str, no need to convert it

Output:

Her name is Lucy, she is 25 years old and she measures 160.5 cm.

Operators

A symbol or function denoting an operation

Basically operators can be used in math.

List of operators:

  • + For adding numbers (can also be used for concatenation) | Eg: 12 + 89 = 101
  • - For subtracting numbers | Eg: 65 - 5 = 60
  • * For multiplying numbers | Eg: 12 * 4 = 48
  • / For dividing numbers | Eg: 60 / 5 = 12
  • ** Exponentiation ("to the power of") | Eg: 2**3 = 8
  • // Floor division (divides numbers and takes away everything after the decimal point) | Eg: 100 // 3 = 33
  • % Modulo (divides numbers and returns whats left (remainder)) | Eg: 50 % 30 = 20

These operators can be used for decreasing/increasing variables.

Example:

x = 12 x += 3 print(x) # this will output 15, because 12 + 3 = 15

You can replace the + in += by any other operator that you want:

x = 6 x *= 5 print(x) y = 9 y /= 3 print(y) # this will output 30 and then below 3.

Also: x += y is just a shorter version of writing x = x + y; both work the same


Comparison Operators

Comparsion operators are for, well, comparing things. They return a Boolean value, True or False. They can be used in conditionals.

List of comparison operators:

  • == equal to | Eg: 7 == 7
  • != not equal to | Eg: 7 != 8
  • > bigger than | Eg: 12 > 8
  • < smaller than | Eg: 7 < 9
  • >= bigger than or equal to | Eg: 19 >= 19
  • <= smaller than or equal to | Eg: 1 <= 4

If we type these into the console, we will get either True or False:

6 > 7 # will return False 12 < 80 # will return True 786 != 787 # will return True 95 <= 96 # will return True

Conditionals

Conditionals are used to verify if an expression is True or False.

if

Example: we want to see if a number is bigger than another one.

How to say in english: "If the number 10 is bigger than the number 5, then etc.

How to say it in Python:

if 10 > 5: # etc.

All the code that is indented will be inside that if statement. It will only run if the condition is verified.
You can also use variables in conditionals:

x = 20 y = 40 if x < y: print("20 is smaller than 40"!) # the output of this program will be "20 is smaller than 40"! because the condition (x < y) is True.

elif

elif is basically like if; it checks if several conditions are True

Example:

age = 16 if age == 12: print("You're 12 years old!") elif age == 14: print("You're 14 years old!") elif age == 16: print("You're 16 years old!")

This program will output:

You're 16 years old!

Because age = 16.

else

else usually comes after the if/elif. Like the name implies, the code inside it only executes if the previous conditions are False.

Example:

age = 12 if age >= 18: print("You can vote!") else: print("You can't vote yet!)

Output:

You can't vote yet!

Because age < 18.


input

The input function is used to prompt the user. It will stop the program until the user types something and presses the return key.
You can assign the input to a variable to store what the user types.

For example:

username = input("Enter your username: ") # then you can print the username print("Welcome, "+str(username)+"!")

Output:

Enter your username: Bookie0 Welcome, Bookie0!

By default, the input converts what the user writes into str, but you can specify it like this:

number = int(input("Enter a number: ")) # converts what the user says into an int # if the user types a str or float, then there will be an error message. # doing int(input()) is useful for calculations, now we can do this: number += 10 print("If you add 10 to that number, you get: "+ str(number)) # remember to convert it to str for concatenation!

Output:

Enter a number: 189 If you add 10 to that number, you get: 199

You can also do float(input("")) to convert it to float.


Now, here is a little program summarizing a bit of what you've learnt so far.

Full program:

username = input("Username: ") password = input("Password: ") admin_username = "Mr.ADMIN" admin_password = "[email protected]" if username == admin_username: if password == admin_password: print("Welcome Admin! You are the best!") else: print("Wrong password!") else: print("Welcome, "+str(username)+"!")

Now a detailed version:

# inputs username = input("Username: ") # asks user for the username password = input("Password: ") # asks user for the password # variables admin_username = "Mr.ADMIN" # setting the admin username admin_password = "[email protected]" # setting the admin passsword # conditionals if username == admin_username: # if the user entered the exact admin username if password == admin_password: # if the user enters the exact and correct admin password print("Welcome Admin! You are the best!") # a welcome message only to the admin else: # if the user gets the admin password wrong print("Error! Wrong password!") # an error message appears else: # if the user enters something different than the admin username print("Welcome, general user "+str(username)+"!") # a welcome message only for general users

Output:

An option:

Username: Mr.ADMIN Password: i dont know Error! Wrong password!

Another option:

Username: Mr.ADMIN Password: [email protected] Welcome Admin! You are the best!

Final option:

Username: Bob Password: Chee$e Welcome, general user Bob!

A bit of lists

A list is a collection which is ordered and changeable. They are written with square braquets: []

meat = ["beef", "lamb", "chicken"] print(meat)

Output:

['beef', 'lamb', 'chicken']

You can access specific items of the list with the index number. Now here is the kinda tricky part. Indexes start at 0, meaning that the first item of the list has an index of 0, the second item has an index of 1, the third item has an index of 2, etc.

meat = ["beef", "lamb", "chicken"] # Index: 0 1 2 etc. print(meat[2]) # will output "chicken" because it is at index 2

You can also use negative indexing: index -1 means the last item, index -2 means the second to last item, etc.

meat = ["beef", "lamb", "chicken"] # Index: -3 -2 -1 etc. print(meat[-3]) # will output "beef" because it is at index -3

You can add items in the list using append():

meat = ["beef", "lamb", "chicken"] meat.append("pork") print(meat)

Output:

['beef', 'lamb', 'chicken', 'pork']

"pork" will be added at the end of the list.

For removing items in the list, use remove():

meat = ['beef', 'lamb', 'chicken'] meat.remove("lamb") print(meat)

Output:

['beef', 'chicken']

You can also use del to remove items at a specific index:

meat = ['beef', 'lamb', 'chicken'] del meat[0] print(meat)

Output:

['lamb', 'chicken']

There are also many other things you can do with lists, check out this: https://www.w3schools.com/python/python_lists.asp for more info!


for loops

A for loop is used for iterating over a sequence. Basically, it runs a piece of code for a specific number of times.

For example:

for i in range(5): print("Hello!")

Output:

Hello! Hello! Hello! Hello! Hello!

You can also use the for loop to print each item in a list (using the list from above):

meat = ['beef', 'lamb', 'chicken'] for i in meat: print(i)

Output:

beef lamb chicken

while loops

while loops will run a piece of code as long as the condition is True.

For example:

x = 1 # sets x to 1 while x <= 10: # will repeat 10 times print(x) # prints x x += 1 # increments (adds 1) to x

Ouput:

1 2 3 4 5 6 7 8 9 10

You can also make while loops go on for infinity, like so (useful for spamming lol):

while True: print("Theres no stopping me nowwwww!")

Output:

Theres no stopping me nowwwww! Theres no stopping me nowwwww! Theres no stopping me nowwwww! Theres no stopping me nowwwww! Theres no stopping me nowwwww! # etc until infinity

Functions

Functions are a group of code that will only execute when it is called.

For example, instead having to type a piece of code several times, you can use a function to put that piece of code inside, and then when you need to use it, you can just call it.

def greeting(): # defining the function print("Bonjour!") # everything that is indented will be executed when the function is called greeting() # calling the function # you can now call this function when you want, instead of always writing the same code everytime

Output:

Bonjour!

return and arguments

The return statement is used in function. It ends the function and _ "returns" the result, i.e. the value of the expression following the return keyword, to the caller._ It is not mandatory; you don't have to use it.

You can also have arguments inside a functions. This allows you to change the function values. The arguments are in the parenthesis.

For example:

def sum(x, y): # x and y are the arguments total = x + y return total # "assigns" x + y to the function result = sum(4, 5) # you can change those to what you want print(result) # this will output 9, because 4+5 = 9

Imports

time

You can use time in your Python programs.

How to make the program wait:

# first import time import time print("Hello!") # then for the program to wait time.sleep(1) # write how long you want to wait (in seconds) in the parenthesis print("Bye!")

Output:

Hello! # program will wait 1 second Bye!

You can also do this (more simpler):

import time from time import sleep # instead of time.sleep(), do sleep() # its the same print("time.sleep(1)...") time.sleep(1) print("...is the same as...") sleep(1) print("sleep(1)!")

random

You can use the random module to randomly pick numbers with randint():

# remember to import! import random from random import randint rand_num = randint(1,5) # this will output a random number between 1 and 5 inclusive! # this means the possible numbers are 1, 2, 3, 4, or 5

The reason I am precising this is because you can also use randrange():

import random from random import randrange rand_num = randrange(1,5) # this will output a random number between 1 inclusive and 5 NON-inclusive (or 4 inclusive)! # this means the possible numbers are 1, 2, 3, or 4

You can also randomly pick an item from a list with choice():

import random from random import choice meat = ["beef", "lamb", "chicken"] rand_meat = choice(meat) print(rand_meat) # this will output a randomly chosen item of the list meat # the possible outcomes are beef, lamb, or chicken.

math

First, you already have some functions already built in Python: min() and max(). They return the smallest and biggest value of ints inside the parenthesis, respectively.

For example:

list_a = min(18, 12, 14, 16) list_b = max(17, 19, 15, 13) print(list_a) # will output 12 print(list_b) # will output 19

Now for some more modules:

You can use math.floor() and math.ceil() to round up numbers to the nearest or highest int.

For example:

# first import import math num_a = math.floor(2.3) num_b = math.ceil(2.3) print(num_a) # will output 2 print(num_b) # will output 3

Explanation (from Andrew Sutherland's course): So math.floor() will round up 2.3 to the nearest lowest int, which in this case is 2. This is because, if you imagine it, the floor is on the bottom, so thats why it will round the number to the nearest lowest int.

Vice-versa for math.ceil(); it will round up 2.3 to the nearest highest int, which in this case is 3. This is because ceil is short for ceiling (programmers like to shorten words), and the ceiling is high.

You can also get pi π:

import math pi = math.pi print(pi)

Output:

3.141592653589793

Here is the full list of all the things you can do with math: https://www.w3schools.com/python/module_math.asp


Small Programs You Can Use

Countdown Program:

# imports import time from time import sleep def countdown(): # making a function for the countdown (so you can use it several times) count = int(input("Countdown from what? ")) # asks user how long the countdown while count >= 0: # will repeat until count = 0 print(count) # prints where the countdown is at count -= 1 # subtracts 1 from count sleep(1) # program waits 1 second before continuing print("End of countdown!") # message after the countdown countdown() # remember to call the function or nothing will happen

Output:

Countdown from what? 5 5 4 3 2 1 0 End of countdown!

Simple Calculator

First way using eval()

calculation = input("Type your calculation: ") # asks the user for a calculation. print("Answer to " + str(calculation) + ": " + str(eval(calculation))) # eval basically does the operation, like on a normal calculator. # however, if you write something different than a valid operaion, there will be an error.

Or another way, using several conditionals, and you can only do "something" + "something" (but with the operators):

def calculator(): # making a function to hold all the code for calculator while True: # loops forever so you can make several calculations without having to press run again first_num = int(input("Enter 1st number: ")) # asks user for 1st number second_num = int(input("Enter 2nd number: ")) # asks user for 2nd number operator = input("Select operator: + - * / ** // ") # asks user for operator if operator == "+": # addition answer = first_num + second_num print(answer) elif operator == "-": # subtraction answer = first_num - second_num print(answer) elif operator == "*": # multiplication answer = first_num * second_num print(answer) elif operator == "/": # division answer = first_num / second_num print(answer) elif operator == "**": # exponentiation ("to the power of") answer = first_num ** second_num print(answer) elif operator == "//": # floor division answer = first_num // second_num print(answer) else: # if user selects an invalid operator print("Invalid!") calculator() # calls the function

But obviously that is pretty long and full of many if/elif.


Some functions that are useful:

"Press ENTER to continue" Prompt:

def enter(): input("Press ENTER to continue! ") # this is useful for text based adventure games; when they finish reading some text, they can press ENTER and the next part will follow. # just call the function where you need it

Spacing in between lines function:

def space(): print() print() # same as pressing ENTER twice, this is useful to make your text a bit more airy, makes it less compact and block like.

Slowprint:

# first imports: import time, sys from time import sleep def sp(str): for letter in str: sys.stdout.write(letter) sys.stdout.flush() time.sleep(0.06) print() # to use it: sp("Hello there!") # this will output Hello There! one letter every 0.06 seconds, making it look like the typewriter effect.

ANSI Escape Codes

ANSI escape codes are for controlling text in the console. You can use it to make what is in the output nicer for the user.

For example, you can use \n for a new line:

name = input("Enter your name\n>>> ")

Output:

Enter your name >>>

This makes it look nice, you can start typing on the little prompt arrows >>>.

You can also use \t for tab:

print("Hello\tdude")

Output:

Hello dude

\v for vertical tab:

print("Hello\vdude")

Output:

Hello dude

You can also have colors in python:

# the ANSI codes are stored in variables, making them easier to use black = "\033[0;30m" red = "\033[0;31m" green = "\033[0;32m" yellow = "\033[0;33m" blue = "\033[0;34m" magenta = "\033[0;35m" cyan = "\033[0;36m" white = "\033[0;37m" bright_black = "\033[0;90m" bright_red = "\033[0;91m" bright_green = "\033[0;92m" bright_yellow = "\033[0;93m" bright_blue = "\033[0;94m" bright_magenta = "\033[0;95m" bright_cyan = "\033[0;96m" bright_white = "\033[0;97m" # to use them: print(red+"Hello") # you can also have multiple colors: print(red+"Hel"+bright_blue+"lo") # and you can even use it with the slowPrint I mentioned earlier!

Output:

Screen Shot 2020-09-01 at 3.45.56 PM

And you can have underline and italic:

reset = "\u001b[0m" underline = "\033[4m" italic = "\033[3m" # to use it: print(italic+"Hello "+reset+" there "+underline+"Mister!") # the reset is for taking away all changes you've made to the text # it makes the text back to the default color and text decorations.

Output:

Screen Shot 2020-09-02 at 9.18.40 AM


Links: Sources and Good Websites

Sources:

Always good to use a bit of help from here and there!

Good Websites you can use:

Interactive:

Goodbye World!: End

Well, I guess this is the end. I hope y'all have learnt something new/interesting! If you have any questions, please comment and I will try my best to answer them.

Have a super day everyone!

PS: STAY 6 FEET APART!!!
My beautiful ASCII art:

Screen Shot 2020-09-02 at 11.30.23 AM

Voters
Profile icon
DHAMMARAKETHYLE
Profile icon
Flippybear
Profile icon
RyanKeeler
Profile icon
SaiLinn
Profile icon
pikachu2507
Profile icon
maxina
Profile icon
Marulv
Profile icon
DiveshTheReal
Profile icon
JaminJS
Profile icon
P0GCHAMPB0i
Comments
hotnewtop
Profile icon
DynamicSquid

This is a complete

B A N G E R

of a tutorial!

Profile icon
Bookie0

lmao thank you! :) @DynamicSquid

Profile icon
DynamicSquid

@Bookie0 actually i don't like it i have to scroll down too much

Profile icon
Bookie0

yea same, its very longgg @DynamicSquid

Profile icon
gibbsfreenergy

Don't scroll then, just reduce the font to like 0.5 and then you wouldn't have to scroll. @DynamicSquid

Profile icon
LizFoster

@JosephSanthosh Solid suggestion!

Profile icon
firefish

@DynamicSquid Middle click, then you just move your mouse to scroll.

Profile icon
dabs364

@JosephSanthosh

THUMBS UP!

/\

/ \ ___

|........._|

|........._|

—————

Profile icon
gibbsfreenergy

Not bad... @dabs364

Profile icon
Navinor
print('This is an amazing tutorial!! ^_^')
Profile icon
Bookie0

@Warhawk947

while True: print("Woooh thx!! :)")
Profile icon
LizFoster

Wow. Just wow! This is incredible, and it highlights all the things a beginner would need to learn! Good work!

Profile icon
Bookie0

thank you so much! :) @LizFoster

Profile icon
CodingGoose

This is a ** GREAT ** beginner tutorial! I love that you intentionally put an error to explain something.
Great job :)

p.s. thx now I know how to do _ italic _ and underlined text. YAY!

Profile icon
Bookie0

lol thanks! ;) @DannyIsCoding

Profile icon
VulcanWM

Epic tutorial!

Profile icon
Bookie0

thanks! :) @VulcanWM

Profile icon
VulcanWM
Profile icon
P0GCHAMPB0i

POOP! WHO CARES WE CAN JUST GO TO STACKOVER FLOW JK BUT THIS IS REALLY GOOD BUT YOU FORGOT TO ADD MOST OF THE ONES THAT YOU FORGOT

Profile icon
Bookie0
Profile icon
BryanHuie

Thanks, I didn't know how to make an print statement that used the input that someone put in.

Profile icon
Bookie0

Haha, glad you liked it! :) @BryanHuie

Profile icon
AgamKapoor

Thanks

Profile icon
Bookie0

np! Glad this helped! :) @AgamKapoor

Profile icon
emerispendragon

Thank you for this, I have no programming experience but this is a nice quick intro.

Profile icon
Bookie0

np, glad this can help! :D @emerispendragon

Profile icon
[deleted]

🤯🤯🤯🤯🤯 mind blown totally this is the greatest tutorial ever

Profile icon
Bookie0

lol thanks! :) @ConorTseng

Profile icon
NaimSever

This is AMAZING it helped me learn so much more in python that I knew I am a new Dev and this helped me SOOOOO much! Its worth reading!

Profile icon
Bookie0

@NaimSever Lol thanks! :) Glad this helped!

Profile icon
NaimSever

@Bookie0 also if you would show how to make multiple accounts in 1 code it would be nice :)

Profile icon
Bookie0

@NaimSever wdym multiple accounts in 1 code?

Profile icon
NaimSever

@Bookie0 i mean like with the usernames how to add multiple usernames in 1 code without error

Profile icon
Bookie0

@NaimSever sorry, bud, you're gonna have to be a bit more precise...
what language? do you mean with databases? is this a game or a website? etc.

Profile icon
NaimSever

@Bookie0 remember this
"# inputs
username = input("Username: ") # asks user for the username
password = input("Password: ") # asks user for the password

variables

admin_username = "Mr.ADMIN" # setting the admin username
admin_password = "[email protected]" # setting the admin passsword

conditionals

if username == admin_username: # if the user entered the exact admin username

if password == admin_password: # if the user enters the exact and correct admin password print("Welcome Admin! You are the best!") # a welcome message only to the admin else: # if the user gets the admin password wrong print("Error! Wrong password!") # an error message appears

else: # if the user enters something different than the admin username
print("Welcome, general user "+str(username)+"!") # a welcome message only for general user"
i want to know how i can make multiple of these without and error

Profile icon
Bookie0

@NaimSever can you precise your question a bit?

do you mean more conditionals that check if the password is equal to other things? in that case, just use elif, I covered that as well in the tutorial

Profile icon
NaimSever

@Bookie0 i need some codes to ignore other lines so it doesnt say Welcome on 1 text and say incorrect password on like the 3 other texts

Profile icon
DungeonMaster00

OH MY GOD HOW IS THIS THING STILL ON THE TOP OF HOT ON THE TUTORIALS BOARD OF REPL TALK

Profile icon
Bookie0

lmao thanks :) @DungeonMaster00

Profile icon
ChezCoder

sigh... i wish my tutorials got this much attention! 😢

Profile icon
Bookie0

oof.. which tutorial did you make? I'll check it out :) @ChezCoder

Profile icon
ChezCoder

@Bookie0 i've made plenty, sadly they have't gotten much notice :<
for example, my XMLHttpRequest tutorial had lots of effort put into it, but with no avail

Profile icon
Bookie0

oof, link it and I'll check it out! ;) @ChezCoder

Profile icon
ChezCoder

@Bookie0 the mods have been very bias towards me, i was warned
for advertising when i merely mentioned my projects on a post a few months ago. But anyways, here it is. Hope you enjoy it.

sigh... im dying on repl
Profile icon
Bookie0

@ChezCoder Ok Imma check it out.
btw, you say you were warned for advertising when you mentioned your projects on a post; was it your post or someone else's post? if it wasnt your post, then yea I guess that would be advertsising.

also popularity on repl.it doesnt really matter, its mostly how you code ;)

Profile icon
DynamicSquid

@ChezCoder no pls don't die you're a great user here!

Profile icon
Bookie0
Profile icon
beartam12345

its really good but but on the color for the python there's a error the

you can also have multiple colors:

print(red+"Hel"+bright_blue+"lo) see how the lo doesn't have " " only "lo so yea but everything is awesome!

Profile icon
Bookie0

wdym? Hel and lo should be together, no space between? @beartam12345

Profile icon
beartam12345

@Bookie0 uh no u tried to add different colors for hel then different color for lo but lo was incorrect but everything was awesome!

Profile icon
Bookie0

ah yes, found the typo, thanks! ;)
@beartam12345

Profile icon
beartam12345

@Bookie0 Np but hx this helped me a LOT!

Profile icon
beartam12345
Profile icon
Bookie0
Profile icon
aguy11

Hello! I would just like to note that there is actually a better way to concatenate strings:

name = input("What is your name? ") age = input("How old are you? ") print(f"Your name is {name} and you are {age} years old!") # F-Strings!

Otherwise...

Nice Tutorial!

Profile icon
Bookie0

@aguy11 hi,

thanks for the info, I didnt know that. I used the + method because then you have to convert the ints and floats to str, which is kinda useful to know as well.

But thanks anyways :)

Profile icon
aguy11

@Bookie0 No problem. Yeah, I guess you gotta learn int(), str() and stuff like that before you learn F-Strings

Profile icon
Bookie0

yea, i think theres also:

name = "bobby" print("Hi %s"%(name))

@aguy11

Profile icon
aguy11

@Bookie0 I never actually learned that, it seemed so confusing. :)
Sorta annoying these things are, Error on line one:

Traceback most recent call last, whatever else you say name = bobby Line 1, NameError: Name `bobby` is not defined
Profile icon
Bookie0

ah yes whoops
its

name = "bobby" print("Hi %s"%(name))

i forgot to put " around bobby
but yea its a bit more confusing the concatenation :)
@aguy11

Profile icon
mylifeiscrap

Cool!

Profile icon
XanthusPettitt

Thank you!

Profile icon
Bookie0
Profile icon
XanthusPettitt

@Bookie0 hi sorry to bother you but how do you make 1 line code in python if you can

Profile icon
Bookie0
Profile icon
XanthusPettitt

@Bookie0 well im trying to make a 1 line code sorta like, https://repl.it/talk/share/live-chatroom-one-liner-1-line-seriesno5/116248?order=new, just a lot more simple

Profile icon
Bookie0

@XanthusPettitt yea why not fork that repl, and try to look at the code. Also contact that person.

Profile icon
XanthusPettitt
Profile icon
CodingCactus

just realised how similar this is to mine :/
https://repl.it/talk/learn/How-to-python-GCSEThe-Basics/35819

Profile icon
Bookie0

@CodingCactus indeed most tutorials follow similar contents and organization. while I mostly used w3 schools and tutorialspoint, I did look through some tutorials made on repl.it like yours to see how theirs was like ;)

Profile icon
CodingCactus

@Bookie0 🤔

Profile icon
Bookie0

@CodingCactus ¯\_(ツ)_/¯

Profile icon
[deleted]

i've seen your bramjam game i think it is awesome for people who do not like it

Profile icon
Bookie0

lol thanks! :) @ConorTseng

Profile icon
Muffinlavania

Nows thats a lot of damage text! Cool tutorial by the way, and also its not stay 6 feet apart, its 2 squids apart. (Your welcome all you squid folk)

Profile icon
Bookie0

Hehe, depends how big the squid is lol

Thanks tho :) @Muffinlavania

Profile icon
CuriousMonkey

hey bookie i found this repl that is vry ooffensive. i think you should see it for yourself: https://repl.it/talk/share/Bookie0-Plz-RUn-this-repl/56054

Profile icon
Bookie0

hi,

thanks, but it leads to a 404 page, I guess it was taken down lol @CuriousMonkey

Profile icon
CuriousMonkey

oh ye prbly but it was made my someone named pro32, you prbly have to be careful around him @Bookie0

Profile icon
Bookie0

hum ok then thanks! :) @CuriousMonkey

Profile icon
CuriousMonkey

@Bookie0 hey also one more thing, would you like to help me with a project i am making. i see you are learning c++ so i was hoping you could help me. its ok if you don't want to but it would be awsome if u did. btw the projects is a voting thing where you vote if you like mango juice or orange juice better. also it will be only c++ and some text files but thats it. thank you for reading this and be caring ;)

Profile icon
Bookie0

@CuriousMonkey

hi yea I know a bit of c++, but sorry, I can't really collab as I don't have much times these days (school, HW, tests, etc).

Also, you mention that your project is a sorta voting thing; are you planning on just making the data temporary (reset when you press the run button again) or are you planning on making a data base or something, that would be cool lol.

However, if you have some questions I can try, with my limited knowledge, to help you! ;)

Good luck! :D

Profile icon
CuriousMonkey

oh thats ok same i can only code on saturday and sunday
pretty much. also for the vote thing i dont know how database works so i am going to make a normal text file with the number of votes in it and the c++ program will increase it using ostream @Bookie0

Profile icon
Bookie0

@CuriousMonkey

hum well then when you press the run button everything will be set back but ok your choice! ;)

Profile icon
CuriousMonkey

no it wont its in a differen file @Bookie0

Profile icon
Bookie0
Profile icon
tankerguy1917

thank. this tuorial is really helpful, but yellow = "\033[0;33m" ended up making orange and not yellow, but bright yellow works, so i dont see too much of an issue

Profile icon
Bookie0

Oh yea, that makes it an orange lol thanks for pointing that out ;)

Happy that this helped you! :D @tankerguy1917

Profile icon
LTI2

@Bookie0 Yes you're the ceo of repl.it yes totally i understand uncle jimmy

Profile icon
Bookie0

lmao @LTI2

Profile icon
CeresNg

um...

Profile icon
Bookie0

? typo? error? something not working? @CeresNg

Profile icon
[deleted]

Thank u @Bookie0 really helped

Profile icon
Bookie0

cool! happy this helped you ;) @FluidCycling

Profile icon
[deleted]

@Bookie0 Yeah im new to python thats why

Profile icon
Bookie0

cooL! good luck learning! :) @FluidCycling

Profile icon
[deleted]

@Bookie0 Thanks Hope u will help me in the future!

Profile icon
Bookie0
Profile icon
[deleted]

@Bookie0 Thanks would u mind helping me to make an OS?

Profile icon
[deleted]

@Bookie0 To work together will u join my team it would be a big help since ive got a student who is new to coding

Profile icon
Bookie0

sorry I dont know how to make an OS. You'll need to know more than just this tutorial for that :/ @FluidCycling

Profile icon
[deleted]

@Bookie0 Yeah I tried but I got an error saying exit status 1. So if u want to help to make a game pls ping me k?

Profile icon
Bookie0

whats the error? @FluidCycling

Profile icon
[deleted]

@Bookie0 exit status 1 when i tried making an OS using Bash

Profile icon
Bookie0

sorry, i dunno how to help @FluidCycling

Profile icon
[deleted]

@Bookie0 ohh nvm I was just asking for some ideas since u know a lot on python!

Profile icon
Bookie0

you need some ideas? here:

  • pacman
  • battleship
  • choice making game
  • quiz (like harry potter quiz, math quiz, star wars quiz)
  • personality quiz (like which house are you in HP, are you a nerd/jock/popular/idiot etc)
  • tic tac toe
  • pong
  • uno
  • dice rolling game
  • name/place/idea/story generator
  • HTML webpage about yourself
  • text based adventure game
  • simulator (Life sim, cooking sim, teacher sim, fighting sim, etc.)
  • hotel managment game
  • tycoon game (idle factory game, idle miner game, idle city game)
  • minecraft but simpler
  • ascii art/animation
  • url shortener
  • site like another site (site like repl.it, google, amazon)
  • clicker game
  • make a tutorial about something you know well of
  • learn a new language (like C, C++, C#, nodeJS, javascript, ruby, haskell, etc.)

If you need more ideas, you can just google on the internet "python program ideas"; here are some results:

https://www.upgrad.com/blog/python-projects-ideas-topics-beginners/

https://data-flair.training/blogs/python-project-ideas/

https://www.geeksforgeeks.org/7-cool-python-project-ideas-for-intermediate-developers/

Good luck!

@FluidCycling

Profile icon
[deleted]
Profile icon
Bookie0
Profile icon
Jakman

What about error handling m8?

Profile icon
Bookie0
Profile icon
Jakman

@Bookie0 such as

try: pass except: pass finally: pass
Profile icon
Bookie0

oh those yea idk if I will do it since this is kinda like the basics, but later if I have time I might add it ;) @Jakman

Profile icon
Jakman

@Bookie0 it will definietly make for a intermediate tutorial

Profile icon
Bookie0

@Jakman yea ok I will add it tomorrow

Profile icon
LoneVigil

Thanks for this, It'll definitely help before I begin my programming courses

Profile icon
Bookie0

cool!, I'm happy this helped you ;) @LoneVigil

Profile icon
firefish

\e[38;5;166mGreat tutorial! ANSI codes aren't part of python... they are... part of the terminal\e[0m

Profile icon
Bookie0

oh ok lol but i still put them because they are useful to know @firefish

Profile icon
firefish

@Bookie0 Well you shouldn't say tthat they are exclusive to python

Profile icon
Bookie0

i didnt...did i? i just said ANSI escape codes as the title, but yes you're right you can use them in other langs too @firefish

Profile icon
gibbsfreenergy

This is the problem with being famous:

image

Profile icon
Bookie0
Profile icon
gibbsfreenergy

literally though @Bookie0

Profile icon
Bookie0
Profile icon
DavidLi17

@JosephSanthosh where did you find that?

Profile icon
gibbsfreenergy

On the floor. @DavidLi17

Profile icon
octopyBot

@JosephSanthosh true people have this stuff about you, and plus, you can see he smokes and drinks. that stuff gets into your head. I would avoid being famous at all costs.

✨oh, who am I kidding!!✨

Profile icon
gibbsfreenergy
Profile icon
octopyBot
Profile icon
ShivankChhaya

I'm in my 5th week of school.....

Profile icon
Bookie0
Profile icon
Kookiez

@ShivankChhaya I'm in my 4th

Profile icon
DavidLi17

@ShivankChhaya im in my -1st

Profile icon
ShivankChhaya
Profile icon
firefish

@ShivankChhaya I'm my 1st... or was three days ago now the 2nd

Profile icon
Carolynp7

Do you have any ideas on how to introduce coding to preschools kids?

Profile icon
Bookie0

@Carolynp7 well preschool seems a bit young, but I guess if they’re motivated to learn, the sure! They can start with maths and algebra which will help them later. They could also start learning block coding (such as Scratch).

Good luck! :)