Skip to main content

Python Basics- Lists

List is one of the most important data structure in Python. you can find details here -  data structure in Python

In this tutorial we will see some useful operations-creating/updating/removing a list that occurs in a life of data scientist.

Store the values 'python', 'c', and 'java' in a list. Print each of these values out, using their position in the list.


Here we can also use print(myList[0],myList[1],myList[2]) in a line

Note: The indexing starts here with 0 not from the 1 from left to right and from right to left it starts with -1.


Working List:-
  • Make a list that includes four careers, such as 'programmer' and 'truck driver'.
  • Use the list.index() function to find the index of one career in your list.
  • Use the in function to show that this career is in your list.
  • Use the append() function to add a new career to your list.
  • Use the insert() function to add a new career at the beginning of the list.
  • Use a loop to show all the careers in your list.


Ordered Working List:-

Start with the list you created in Working List.
  • You are going to print out the list in a number of different orders.
  • Each time you print the list, use a for loop rather than printing the raw list.
  • Print a message each time telling us what order we should see the list in.
  • Print the list in its original order.
  • Print the list in alphabetical order.
  • Print the list in reverse alphabetical order.
  • Print the list in the reverse order from what it started.
  • Permanently sort the list in alphabetical order, and then print it out.
  • Permanently sort the list in reverse alphabetical order, and then print it out.


Ordered Numbers:-

  • Make a list of 5 numbers, in a random order.
  • You are going to print out the list in a number of different orders.
  • Each time you print the list, use a for loop rather than printing the raw list.
  • Print a message each time telling us what order we should see the list in.
  • Print the numbers in the original order.
  • Print the numbers in increasing order.
  • Print the numbers in decreasing order.
  • Print the numbers in the reverse order from how they started.
  • Permanently sort the numbers in increasing order, and then print them out.
  • Permanently sort the numbers in decreasing order, and then print them out.


Getting List Length:-




So keep practicing by your own with above examples in your notebook and comment if you face any issue.

Comments

  1. Nice Explanation About Python-Lists .Good Information for Data Aspirants.
    Want to Learn or Looking for Training on Python, Data Science, Machine Learning
    Please Visit Codegnana IT Solutions In Vijayawada.
    Data Science Training in Vijayawada

    ReplyDelete
  2. Very clear-cut information easy to understand. Thanks for providing for more updates.
    Microsoft Azure DevOps Online Training

    ReplyDelete
  3. Hi, I read your whole blog. This is very nice. Good to know about the career in Python Training & Certification. We are also providing various Python Training , anyone interested can Python Courses for making their career in this field .

    ReplyDelete
  4. Excellent post. You have shared some wonderful tips. I completely agree with you that it is important for any blogger to help their visitors. Once your visitors find value in your content, they will come back for more What is the Python



    ReplyDelete
  5. Thank you for sharing an amazing & wonderful blog. This content is very useful, informative and valuable in order to enhance knowledge. Keep sharing this type of content with us & keep updating us with new blogs. Apart from this, if anyone who wants to join the Python Base training institute in Delhi, can contact 9311002620 or visit our website-
    https://www.htsindia.com/Courses/python/python-training-institute-in-delhi

    ReplyDelete
  6. I loved your blog post on how to learn data science using Python. I'm really impressed that you've been able to find the time to write blog posts while still working a full-time job. It's really inspiring to see that you're using a passion to help others learn, too.
    Learn .NET

    ReplyDelete
  7. Thankyou for such amazing article about python. Open the doors of career from python course in Greater Noida

    ReplyDelete
  8. APTRON Solutions Noida is the go-to training institute for Python Training in Noida. Our courses are designed to equip students with the skills and knowledge needed to succeed in today's technology-driven world. With our expert trainers, state-of-the-art facilities, and comprehensive training programs, you can be sure that you're getting the best training available. Don't hesitate to contact us today to learn more about our Python training courses.

    ReplyDelete
  9. Enroll in our Python Course in Noida at APTRON Solutions NOIDA and take the first step towards a rewarding career in programming. Whether you aspire to be a Python developer, data analyst, or web developer, our comprehensive course will equip you with the necessary skills and knowledge. Don't miss this opportunity to learn from the best in the industry. Contact us today to know more about our Python course and kickstart your journey to success.

    ReplyDelete
  10. I recently came across your blog post about Python training in Noida, and I must say it's a fantastic resource for individuals looking to learn Python in the region.

    ReplyDelete
  11. This comment has been removed by the author.

    ReplyDelete
  12. The blog was super informative and easy to understand. I really appreciate the way you have informed us about the Python Training in Noida.

    ReplyDelete
  13. Are you ready to unlock the full potential of Python programming? Look no further! APTRON's Python Training Course in Gurgaon is your gateway to mastering the most versatile and in-demand programming language today. Whether you're a beginner or an experienced programmer, our comprehensive course is designed to cater to all skill levels, providing you with the knowledge and expertise you need to excel in the world of Python.

    ReplyDelete
  14. Flexibility is another key feature of our CCNA Training Course in Noida. We offer both weekday and weekend batches to accommodate your schedule. Whether you are a student or a working professional, we have a schedule that suits your needs. Moreover, our training center is equipped with the latest networking equipment, allowing you to gain practical experience with the same tools and technologies used in the industry.

    ReplyDelete
  15. APTRON's Python Training Course in Gurgaon and unlock the vast potential of this versatile programming language. Our trainers will guide you through the learning process, ensuring that you become proficient in Python and ready to tackle real-world challenges. Enroll today and take the first step towards a successful career in Python development!

    ReplyDelete
  16. If you're aspiring to become a data scientist, APTRON Noida should be your first choice. Our Data Science Training in Noida program is designed to equip you with the skills and knowledge required to thrive in this data-driven era. Our Data Science Training in APTRON Noida, focusing on what sets us apart from the competition.

    ReplyDelete
  17. Thank you for providing this insightful information about "DATA SCIENCE" and how it relates to Software development in Chennai. I am better able to understand this dynamic field thanks to you.

    ReplyDelete
  18. Whether you are a fresh graduate, mid-career professional, or aspiring data enthusiast, APTRON Solutions offers a structured learning path to help you excel in the dynamic field of Data Science Training in Noida. Don't wait any longer; take the first step towards a rewarding career by enrolling in our data science training program in Noida. Unlock your potential and become a sought-after data science professional with APTRON Solutions by your side. Reach out to us today to know more about course details, fees, and upcoming batches. Your data science journey awaits!

    ReplyDelete

Post a Comment

Popular posts from this blog

How to deploy your ML model as Fast API?

Another post starts with you beautiful people! Thank you all for showing so much interests in my last posts about object detection and recognition using YOLOv4. I was very happy to see many aspiring data scientists have learnt from my past three posts about using YOLOv4. Today I am going to share you all a new skill to learn. Most of you have seen my post about  deploying and consuming ML models as Flask API   where we have learnt to deploy and consume a keras model with Flask API  . In this post you are going to learn a new framework-  FastAPI to deploy your model as Rest API. After completing this post you will have a new industry standard skill. What is FastAPI? FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints. It is easy to learn, fast to code and ready for production . Yes, you heard it right! Flask is not meant to be used in production but with FastAPI you can use your model in production wi

How to install and compile YOLO v4 with GPU enable settings in Windows 10?

Another post starts with you beautiful people! Last year I had shared a post about  installing and compiling Darknet YOLOv3   in your Windows machine and also how to detect an object using  YOLOv3 with Keras . This year on April' 2020 the fourth generation of YOLO has arrived and since then I was curious to use this as soon as possible. Due to my project (built on YOLOv3 :)) work I could not find a chance to check this latest release. Today I got some relief and successfully able to install and compile YOLOv4 in my machine. In this post I am going to share a single shot way to do the same in your Windows 10 machine. If your machine does not have GPU then you can follow my  previous post  by just replacing YOLOv3 related files with YOLOv4 files. For GPU having Windows machine, follow my steps to avoid any issue while building the Darknet repository. My machine has following configurations: Windows 10 64 bit Intel Core i7 16 GB RAM NVIDIA GeForce GTX 1660 Ti Version 445.87

How to use opencv-python with Darknet's YOLOv4?

Another post starts with you beautiful people 😊 Thank you all for messaging me your doubts about Darknet's YOLOv4. I am very happy to see in a very short amount of time my lovely aspiring data scientists have learned a state of the art object detection and recognition technique. If you are new to my blog and to computer vision then please check my following blog posts one by one- Setup Darknet's YOLOv4 Train custom dataset with YOLOv4 Create production-ready API of YOLOv4 model Create a web app for your YOLOv4 model Since now we have learned to use YOLOv4 built on Darknet's framework. In this post, I am going to share with you how can you use your trained YOLOv4 model with another awesome computer vision and machine learning software library-  OpenCV  and of course with Python 🐍. Yes, the Python wrapper of OpenCV library has just released it's latest version with support of YOLOv4 which you can install in your system using below command- pip install opencv-python --up