Import Array exercise Using Python
Exercise 1:
Write a program that takes five integers from the user, stores them in an array, and then prints the sum of these integers.
Answer
Exercise 2:
Create an array of 10 integers. Find and print the maximum and minimum values in the array.
Answer
Exercise 3:
Write a program that takes an integer input from the user and creates an array with that many random integers. Print the array and calculate the average of the numbers in the array.
Answer
Exercise 4:
Create two arrays of the same size. Take integer inputs from the user to fill both arrays. Perform element-wise addition of the arrays and print the resulting array.
Answer
Exercise 5:
Write a program to reverse the elements of an array.
Answer
Exercise 6:
Create an array of 8 integers. Shift all elements of the array to the right by two positions. Print the modified array.
Answer
Exercise 7:
Write a program that takes an array of integers as input. Find and print the count of even numbers in the array.
Answer
Exercise 8:
Create an array of 12 integers representing the months of the year. Ask the user to enter a month number (1 for January, 2 for February, etc.) and print the corresponding month.
Answer
Exercise 9:
Write a program that takes two arrays of integers and checks if they are equal (have the same elements in the same order).
Answer
Exercise 10:
Write a program that takes an array of integers and removes all duplicate elements. Print the modified array.
Answer
Comments
Post a Comment