Learn to Code via Tutorials on Repl.it!

← Back to all posts
Python Tutorial - 2

Hello everyone! Welcome back to another Python tutorial.

What we will be learning:

Lesson 2

  • Lists
  • Imports: Random, time (basic stuff)
  • Dictionaries
  • Loops
  • If, Elif, else statements
  • User inputs
  • Operators


Without further ado, let's get started!


Variables overwrite each other. If you create one variable and then change it to another value, the second one overwrites it.
For example:

If we run that, it responds with: Severus.
This is because, on line 1, you put Albus in the box. And then on line 2, Albus goes out of the box and Severus goes inside. When you print it, it just responds with Severus because that's the most recent one.

So yes, there is a way to put more than 1 thing into the box. So you generate a list.

How to:

So printing them out is exactly like a regular variable,

It prints out the whole list, but you might notice that all of it is in square brackets and quotes.
To remove it, you need to convert it.

Now, if you print the new_list out, you will get no brackets.
Now, of course, there is a way to print out a mere part of the list.

The number you put depends. If it is the first item on the list, you put 0. Second gets 1, and so on. You can also use negative numbers, so the last gets -1, second last gets -2, and so on.
1 2 3 4 5 6
-6 -5 -4 -3 -2 -1



Imports, aka modules are special things you can use to do special things. A lot of them are useful, such as time, random, and sys, as I am going to tell you today.


Let's start with time. The most used one of time is sleep.

To first use the module, you must import it.

Once we have it imported, we can now use it.

The time.sleep() will pause the program for a certain amount of seconds. Yes, you can use decimals.


If you run it, you will get Hello, welcome! followed by a short pause, then Here are the instructions...


You will be learning about 2 random features today, randint, and choice.

First, import the module:

Randint makes a random number between a range of your choice.

Response will be a random number between 1 and 200.


Choice will pick a random item in a list.

Remember, you need to close both paretheses because we opened 2. Output: random choice.


Loops well, loop the program for a certain amount of time.
Number loops loop it for a specific amount.

the this-can-be_anything will be equal to the amount it has looped. for example, if it repeated for the 2nd time, this_can_be_anything would be equal to 2.

List loops:

Number will be equal to the next value of the list.

User input

User input allows you to ask a user a question, and then that user will respond.

It will store the user's answer into the variable.

You will enter your name, and it will say Hi, [yourname]

If, elif, else

THis is useful for user input.

How to:

If i run the program and enter "sg", I will get Hi


Operators are like equations in Python. You make them, and then they respond with the answer.

It will respond with 15


Remember when we did lists? Well, we're going to expand that. You can do

But we don't know what "brown" or "black" means.

How to:

This prints out the whole thing^^
To print a certain one, do:


This is the end of Python Tutorials. Bye bye!


Lesson #3 ?




College students will research with observe gear that adapt to the ONLINE TUITION WEBSITE IN PAKISTAN abilties of a pupil. This means above common students shall be challenged with harder duties and questions when a certain degree is executed. Students who enjoy difficulties with a topic gets the opportunity to exercise greater until they attain the desired degree.


although there should be more


very helpful, never coded in python before


when's lesson number 3?


This is a very simple tutorial same as the first lesson. I think it is great for beginners who have never done programming before. Even tho I think it should have other simple stuff rather than imports at the beginning.


feel regret I did not know this before I read your article, thank for sharing with us! https://theimpossiblequiz.online


cool this is a really good tutorial


Well, this got me thinking what other workouts are good for those of us who find ourselves on the road or have limited equipment options. Business Savvy


I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post. Business World Intelligence


This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post! Montgomery Archives


The next time I read a blog, I hope that it doesnt disappoint me as much as this one. I mean, I know it was my choice to read, but I actually thought you have something interesting to say. All I hear is a bunch of whining about something that you could fix if you werent too busy looking for attention. Fly Safely


If your looking for Online Illinois license plate sticker renewals then you have need to come to the right place.We offer the fastest Illinois license plate sticker renewals in the state. Computer Medics of Central Winconsin


I’ve read some good stuff here. Definitely worth bookmarking for revisiting. I surprise how much effort you put to create such a great informative website. Ultra Internet Income


Hi to everybody, here everyone is sharing such knowledge, so it’s fastidious to see this site, and I used to visit this blog daily ISB Computer


I am genuinely thankful to the holder of this web page who has shared this wonderful paragraph at at this place West Palm Beach Business List


I want you to thank for your time of this wonderful read!!! I definately enjoy every little bit of it and I have you bookmarked to check out new stuff of your blog a must read blog! Maryland Internet Marketing


I am looking for and I love to post a comment that "The content of your post is awesome" Great work! Will Write 4 Food


They're produced by the very best degree developers who will be distinguished for your polo dress creating. You'll find polo Ron Lauren inside exclusive array which include particular classes for men, women. Loughborough Innovation


This is a splendid website! I"m extremely content with the remarks!. WI Business


I want you to thank for your time of this wonderful read!!! I definately enjoy every little bit of it and I have you bookmarked to check out new stuff of your blog a must read blog! Whitall


I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well.. United 4 Safety


I think it could be more general if you get a football sports activity Thick Business Band


Thanks, this was very helpful. After these 2 lessons i learned how to make a working calculator ;]


I am a student of Information technology and I don't know any of the programming languages. I tried to study but it all went in vain. Then one of my colleagues of Kuwait best CIPD writing help told me about the replit and i started taking your python lessons. they all are amazing, I am now understanding python language and I can now do basic level programming in python too.


number 3?