Lab 1
Lab 1
o Create a list of 10 integers. Write a program to find the maximum and minimum
numbers in the list.
o Write a program to reverse a list of integers without using the reverse() method.
2. Tuples
o Create a tuple with 5 elements and write a program to convert it into a list.
3. Dictionaries
o Create a dictionary with 5 key-value pairs where keys are strings and values are
integers. Write a program to find the key with the highest value.
4. Sets
o Create two sets of integers. Write a program to find the union and intersection of
these sets.
String Operations
5. String Manipulation
6. String Formatting
o Write a program to format a string to display the first 3 characters and the last 3
characters of a string.
Math Operators
7. Basic Arithmetic
9. Random Numbers
o Write a program to simulate a simple dice roll (generate a random number between
1 and 6).
o Create a numpy array with 10 elements. Write a program to find the mean and
standard deviation of the elements in the array.
Array Operations
o Create a 5x5 numpy array with random integers between 1 and 100. Write a program
to extract the diagonal elements of the array.
o Write a program to replace all even numbers in a numpy array with -1.
o Write a program to create a dictionary where the keys are the first 10 letters of the
alphabet and the values are random integers between 1 and 100.
o Write a program to create a list of tuples where each tuple contains a number and its
square for numbers from 1 to 10.
o Write a program to sort a list of strings based on the length of the strings.