Computer Science, asked by mussvm10, 19 days ago

Q1. Find the incorrect statement/s out of the following:
a) >>> tup1=(1,'2',3,4,5,"6",7,8,9) b)
b) >>>tup4=(170,)
c) >>>tup6= (500)
d) >>>tup7=tuple()
e) >>>tup10=5, 10, 15, 20


Q.2
If
>>>tup1=("bag", "book", "copy", "lunch box", "pencil box")
>>>tup2=(5, 10, 15, 20, 25, 30, 35)

Give the output: a) >>>tup3= tup1[:] b) >>>tup4= tup2[1:5]

Q.3
Consider the following tuple:
monuments=[ 'Kutub Minar', 10, 'Taj Mahal', 20, 'India Gate', 30, 'Char Minar', 40]
states=['Delhi', 'Kerala', 'Tamil Nadu', 'Bihar']
Write Python statements for the following. Kindly state the reason for the operations which not possible.
a) To insert “Red Fort” and “Jantar Mantar” in the tuple monuments
b) To add 50 at the end of the tuple
c) To add tuple of states at the end of the tuple of monuments
d) To replace 3rd, 4th and 5th element of the monuments tuple by “India”.
e) To remove the third element from the tuple monuments.
f) To delete the tuple monuments.
g) To store all elements 2 times in the tuple states.
h) To check whether the element 20 is present in the tuple or not.
i) To swap the elements of tuples, monuments, and states.
j) To display all elements of a tuple states in different lines.

Q.4
Write Python script to display the average of elements from the given tuple of numbers.

Answers

Answered by Ayushiprogod1000
0

Answer:

Python Program to Calculate the Average of Numbers in a Given...

  • Take the number of elements to be stored in the list as input.

  • Use a for loop to input elements into the list.

  • Calculate the total sum of elements in the list.

  • Divide the sum by total number of elements in the list.

  • Exit.
Similar questions