Basics of Python-4

Hello, I'm Priya Chakraborty, a dedicated B.Tech student in Electrical Engineering at Siliguri Institute Of Technology. I'm an enthusiastic learner, constantly seeking to expand my skill set and knowledge base. With a solid foundation in programming languages such as C, R, Python, and MySQL, I'm poised to tackle complex technical challenges.
But my passions extend beyond the realm of engineering. I'm also an aspiring content writer, driven by a curiosity to communicate ideas, both technical and non-technical, in a way that captivates and educates.
My journey is defined by a relentless pursuit of self-improvement, coupled with strong communication skills. I believe in the power of continuous learning and the importance of sharing knowledge.
Day 4
List :
Previously I have discussed that,
A list is a sequential data type
An ordered collection of dataIt is mutable.It's an abstract data type.
Let's solve a few problems on the list :
- Write a python program to reverse a list
l=[34,76,23,11]
print(l[::-1])
output:

this is the easiest way to solve the reverse list by using the slicing operator.
- Write a python program to find out the length of the list
l=[3,6,3,4]
print(len(l))
output :

These are the basic code that I have solved by listing, using keywords.
- Write a Python program to print all negative numbers in a range.
n=int(input("enter the first number"))
m=int(input("enter the second number"))
print([i for i in range(n,m+1) if i<0])
Output:

Here are some basic questions on the list:
| QUESTIONS |
| Write a python program to swap elements in the string list |
| Write a python program to find the length of the list |
| Write a python program to find a maximum of two numbers in Python |
| Write a python program to find a minimum of two numbers in Python |
| Write a python program to check if an element exists in the list |
| Write a python program to clear a list in Python |
| Write a python program to reverse a list |
| Write a python program to clone or Copying a list |
| Write a python program to count occurrences of an element in a list |
| Write a Python Program to find the sum and average of the list in Python |
In my next blogs, you will get to know about loops and their uses.
Thank you.




