PYTHON TUTORIAL
h
CoolCoderSJ (259)

Try it out here
View non interactive online here
View Downloadable PDF here

Yay my first post that came onto the 'hot' section of Repl Talk!
omg yay this is beyond expectations, 130 upvotes! Can we get to 140?

Please make sure you are signed into repl.it or else it gives an error

The Easy Way to Learn Python

With this easy to use Python tutorial, you can learn python the easy way

This Python tutorial covers -

  • IDE Comparison (Level0)
  • Your first hello world! (Level1, Print)
  • String vs. Int vs. Float (Level2)
  • Variables (Level3)
  • Conditionals, with if, elif, and else (Level4)
  • User Inputs (Level5)
  • Lists (Level6)
  • Functions (Level7)
  • 2D Lists (Level 8)
  • Loops (Level 9 & 10)
  • Dictionaries (Level 11)
  • Common Modules (Level 12)

Coming Up

I plan to add the following topics later on

Also Supports -

  • ACCOUNTS
    • These accounts are secure, and only you can access your password. Only you can delete your account, and only you can login with it.

      EDIT: I investigated a bit with the account system, and if u don't have a repl.it account/aren't signed in when using this, then ur account may be deleted if ur browser cookies/cache are cleared.

    • Accounts help save your progress so you don't have to redo hours of tutorial again.
  • Different colors to differentiate tutorial and code.
    • In this tutorial, all text isn't white; And if you get deeper inside, you'll learn how to color your text too!
  • Opportunities for you to try out the code you're learning!
    • Throughout the tutorial, you will get Opportunities to type some code, and have it verified by the PythonTutorBot.

Updates

LISTS GOT ADDED!

Functions are here!

Welcome, 2D Lists!

Loops just got added!

Dictionaries are here

The manual level picker now also shows what each level has, instead of just the number.

Common Modules

Bonus lesson, level0, ide comparison, added

Tell me if you have more you would like to see!
Try it out here
Btw I made this whole thing in 3 days

Note: This whole tutorial was built on my favorite IDE, repl.it

Update:
A while back, I finally set up my own URL shortener with tracking statistics and changed the link to my shortened one, and the results were amazing! The link got 14 views in an hour alone! thanks for your support everyone!

You are viewing a single comment. View All
Bookie0 (4987)

Pretty nice, some tips:

The first thing to note is that there are no semicolons unlike other languages

wdym unlike other languages? not all languages have semicolens

maybe it's me, but perhaps add a space between the ] and the text? And perhaps a > or something to prompt the user?

And when I create an account, there's text but I don't get to see it as it shows for like 1 sec then disappears...

The 'Print' Statement

print doesn't have a capital P

As a note, please use single quotes, NOT double quotes.

both can be used, you should be able to accept both lol

print('Hello World')

Hello World! has a exclamation mark!

this should work, it gives the same output as what you wrote

'hullo' . Please use single quotes. Define it below

again, you don't need single quotes lol you can use double quotes.

Anyways, the rest is pretty fine! :)

CoolCoderSJ (259)

@Bookie0 hmm
thanks for ur feedback
1) I do agree, I think I should add a >
2) Yeah lol sorry I hate js ill change that
3) Yeah hmm I changed that later on, I must have forgotten to accept both in the earlier levels
4) I didn't know that, ill add an exclamation mark
5) U have a space between print and (

I don't think python accepts spaces

Thanks for ur feedback!

CoolCoderSJ (259)

@Bookie0 again, thanks for the feedback, i did change a couple of things, especially the double quotes and signup message timeout.

Btw it was supposed to tell u this after signing up
"Great! Your username is "+username+" and your password is "+password+" Don't worry, only you can access these passwords and usernames, and all data is encrypted. You're going to be redirected to the main page now, Login with your new credentials to get started."

Bookie0 (4987)

@CoolCoderSJ

ok
ok
ok
ok
uhhhhhhhhh
python does accept spaces lol if you didn't know that...

you can also put a lot of space:

np! :D

CoolCoderSJ (259)

@Bookie0 whoa cool I didn’t know that....

CoolCoderSJ (259)

@Bookie0 all right i did have to break yesterday, but as of now, it accepts spaces between print and (.

Bookie0 (4987)

@CoolCoderSJ

this normal? pretty bright lol

CoolCoderSJ (259)

@Bookie0 whoa uh u must have some external script running

This is what I see

and this is after I disabled all of my extensions

Bookie0 (4987)

@CoolCoderSJ yea I have some Chrome Flags..

Due to application errors, for new lines, type a | right after the first line, and pretend all space after that is a new line.

seriously?

what's wrong with this?

and what about this?

also you should add colors for the errors, and also specify what went wrong. You should also add more stuff! :)

CoolCoderSJ (259)

@Bookie0 yeah i really need to fix this, didn't think it was that broken

for the first one:
I think ur doing it fine, and for now u can use the manual level picker since inputs only come at the end.. i need to go through my code and accept spaces everywhere

for the second one: Again same thing:
I think ur doing it fine, and for now u can use the manual level picker since inputs only come at the end.. i need to go through my code and accept spaces everywhere

Also I ask you to put the | because I don't know how to accept multi line inputs in the console

Bookie0 (4987)

@CoolCoderSJ yez yez I do know I'm doing it fine, I'm just highlighting that ur "bot" can't see that it is correct and you should prolly correct it! ;0

Also I ask you to put the | because I don't know how to accept multi line inputs in the console

¯\_(ツ)_/¯

CoolCoderSJ (259)

@Bookie0 all right i went through my code, and I'm pretty sure that it accepts any number of spaces now (hopefully)
I do plan to add functions, lists, dictionaries, and 2d lists in the future, any suggestions for more?

Bookie0 (4987)

@CoolCoderSJ imports? eg random, time, etc.
maybe useful pieces of code (slowprint, clear screen, ANSI escape codes for colors and bold/italic)

CoolCoderSJ (259)

@Bookie0 ohk ill prob add a popular modules and their commands section

CoolCoderSJ (259)

@Bookie0 yay! I found a way to accept multi line input, so now u can hit enter and type normally for the if statement

elipie (323)

@CoolCoderSJ make lexer instead of something else...

elipie (323)

@CoolCoderSJ well.. python is the most misused(and the source of spam on replit) and really slow. You want something compiled

CoolCoderSJ (259)

@elipie wait let me get this right, u hate python because ppl spam python repls? wut a twisted logic
U don't need compiling, Pythons more lightweight
wdym by misused

elipie (323)

@CoolCoderSJ hmm, i see you have been on repl as long as me... hmm Have u been active on repl latley? lots of spamming lol

Yes u do ned compile... fast af boii

while python is:
[insert turtle with python head here]

CoolCoderSJ (259)

@elipie I am active, i did see the spam, but u cant base judgement of a language on that.
Compiling can be fast, but its really heavy, and python has tons more than just turtle.
Ever heard of web.py, flask, web2py, etc?
Reddit used to run on web.py, and Netflix and Lyft runs on flask

elipie (323)

@CoolCoderSJ exactly, python has became so big that its kinda boring, once you know all of it. And, you can easily get lost(a bad thing) once you are in the language. Thats why I am suggesting a different language

CoolCoderSJ (259)

@elipie i...don’t think it’s boring..and there’s tons of documentation..
What language would u suggest..?

programmeruser (371)

@CoolCoderSJ there's a reason people use compiled languages, it's because they're fast.
And python suffers from serious performance problems making it a slow language (see https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/python.html).
Node.js is much faster than Python and still manages to be simple.

CoolCoderSJ (259)

@programmeruser ok true, compiled can be fast, but I disagree with the fact that node js is simpler than python.

First there's the fact that there's .then() , .catch(), async functions, and it can be confusing to use those/know where to put them. I can type a line of code in python that takes 5 lines in node.js.

Second, there's the fact that python can be used for many things, like coding AI.
Yeah, Python is the #1 language to use for coding AI.

Third, python has mutatable and non mutatable (list vs tuple) while js doesnt

Fourth, python has a lot more inbuilt modules, while js doesn't have that many. that means more of npm, whereas pip3 isn't needed that often.

Btw I'm saying all these things from experience, because I have used both node and python.

programmeruser (371)

@CoolCoderSJ

I can type a line of code in python that takes 5 lines in node.js.

I suspect that's because Python uses synchronous approaches which seem to be more "simple" for beginners.

Second, there's the fact that python can be used for many things, like coding AI.

Did you know that AI and most scientific libraries are not written in Python, but in C++? If they were written in Python then they would be slow to the point of unusable.

Third, python has mutatable and non mutatable (list vs tuple) while js doesnt

Can't you just use immutable.js? And how many times have you actually used those?

Fourth, python has a lot more inbuilt modules

Node has a decent amount of built-in modules.

CoolCoderSJ (259)

@programmeruser

I suspect that's because Python uses synchronous approaches which seem to be more "simple" for beginners.

Is that really an issue if it does the same thing in an easier way?

Did you know that AI and most scientific libraries are not written in Python, but in C++? If they were written in Python then they would be slow to the point of unusable.

From a really simple bing search -

Python

Python: Python is viewed as in any case in the rundown of all Artificial Intelligence (AI) development programming languages because of the simplicity.
techindiatoday.com

Python. Python is considered to be in the first place in the list of all AI development languages due to the simplicity. The syntaxes belonging to python are very simple and can be easily learnt.
geeksforgeeks.org

First two things that come up...

Can't you just use immutable.js? And how many times have you actually used those?

While mutatable is much better to work with, immutable is preferred for faster run and shorter projects.

Node has a decent amount of built-in modules.

Its kind of annoying how I have to manually install packages in replit for node whereas with python i can type
import ... to automatically install

Additionally,

"
At this moment, there are more than 66,000 Python vacancies on Indeed and more than 40,000 JavaScript jobs.
"
Python has 22,000 more jobs available right now than js

programmeruser (371)

@CoolCoderSJ repl.it automatically installs Node.js packages.
The synchronous nature of Python is detrimental to its performance.
I forgot to mention this above, but you can create immutable objects with Object.freeze and clone objects with Object.assign.

CoolCoderSJ (259)

@programmeruser

repl.it automatically installs Node.js packages.

Ive tried with numerous repls, and it hasn't worked for me..sooo

I forgot to mention this above, but you can create immutable objects with Object.freeze

Again, node is so complicated. object.freeze? imutable objects in python are defined so simply..
imutable_var = ( "thing", "thing2", etc.)

Also you dropped 2 of my arguments, that hurts your case pretty badly.......

programmeruser (371)

@CoolCoderSJ if it hasn't worked for you, file a bug report at https://repl.it/bugs. It has nothing to do with the language itself.
How is a call to Object.freeze so complicated? The syntax for tuples is just syntactic sugar.

CoolCoderSJ (259)

@programmeruser
syntactic sugar??

let me also say something,

node is mainly built on objects, like

const that_thing {a buncha values so tat u have to use that_thing as an object}

Also u dropped 2 of my arguments (again) which still hurts your case....

CoolCoderSJ (259)

lol @Bookie0 be missing the debate
wouldnt be surprised if @programmeruser is ignoring....
:O
prob just got stuff to do

CoolCoderSJ (259)

@programmeruser nothings wrong with them, but
1) Objects arent always needed
2) They can be kinda hard to learn

programmeruser (371)

@CoolCoderSJ what do you mean they're hard to learn?
And you aren't required in use objects in js.

CoolCoderSJ (259)

@Bookie0 oh yes im so sorry i will move this to a new thread

CoolCoderSJ (259)

@Bookie0

imports? eg random, time, etc.

Im done with everything I planned, anything else?