Q.1. If list=['red' , 'blue' , 'green' , 'yellow'] , what will be the output of :
list.pop('blue')
print(list)
ANSWER: 4, ERROR
REASON ERROR BECAUSE CODE IS INCORRECT.
Q:2. Which function will remove an item from a list?
ANSWER \::3,pop()
REASON WE USE POP() BECAUSE IT DELETE THE ITEM FROM LIST.
Q:3. If list=['suzuki', 'subaru', 'honda', 'maruti'] , what will be the output of
print(list[3])
after running the code :
list.sort(reverse=True) ?
ANSEWR ::3, HONDA
REASON HONDA BECAUSE THIS IS AT .
Q:4. Which statement is correct?
ANSWER::2,sorted() method maintains the sorted order of the items in the list.
REASON ::::SORTED() METHOD MAINTAINS THE SORTED ORDER OF THE ITEMS IN THE LIST BECAUSE IT WILL SHORT THAT.
Q:5 Which method is used to arrange the items of a list in ascending order in python?
ANSWER:::1,sort()
REASON ::SORT() WILL GONE ARRANGE THE ORDER OF LIST IN PYTHON.
Q:7. How is a line, or a group of lines, related to the rest of the python program?
ANSWER::1.square brackets []
REASON :::SQUARE BRACKETS [] IT WILL MAKE THAT .
Q:8. If numbers=[1, 2, 3, 4, 5] , then how to get the largest value of this list?
ANSWER:::(numbers)
REASON MAX(NUMBERS) IT WILL MAKE A LARGEST NUMBER IN ORDER OF THAT.
Q:9. What should come in place of X if we want to print HI! 6 times?
for i in range(X):
print('HI!'')
ANSWER ::4, 1,7
REASON::IT WILL GONE MAKE A REPEATING LOOP THAT WILL RUN 1 TO 7.
Q:10. Which of the following is a valid singleton tuple?
ANSWER::2.single=1,
REASON ::SINGLE = 1 IT WILL WORK.
HAVE A NICE DAY 😉😉
Comments
Post a Comment