Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q12. What will the following program print out? print(sf:]) Ans: A/= B/ ['red', 'orange', yellow, blue, 'green'] c/'red', 'orange', yellow', 'blue', 'green' Dfs:]] Q13. What

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Q12. What will the following program print out? print(sf:]) Ans: A/= B/ ['red', 'orange', "yellow, blue", 'green'] c/'red', 'orange', "yellow', 'blue', 'green' Dfs:]] Q13. What will the following program print out? print(max(s)) Ans: Afred B/ orange c/ yellow D/blue Q14. What will the following program print out? print(min(s)) Ans: Af red B/ orange c/blue D/ green Q15. Which of the following is not a valid list? Ans: A/[0] B/ ['a', 'b, 'c', 89] c/ [True, 'True', False, 'False'] D/ ' [a,b,c,d] Q8. Which of the following Python function can return the length of a string? Ans: A length() B/ howlong[] C/ len() D/str() Q9. What is the output of the following program? sum({1,2,3]) Ans: A/3 B/ 2 c/6 D /5 Q10. What will the following program print out? For Question 1 to 5 , there is a list with contents assigned. x=(0,1,2,3,4,5,6,7,8,9] Q1. Which of following code would get the result as below: [0,1,2,3,4,5,6,7] Ans: A/ print (x[0:7]) B/ print (x[07]) C/ print (x[0:8]) D/ print (x(08]) Q2. What would the program below print out? print x (0:6]) Ans: A/ [0,1,2,3,4,5,6,7] B/[0,1,2,3,4,5,6] C/[0,1,2,3,4,5] D/[0,1,2,3,4] Q3. What would the program below print out? print(x/3:1) Ans: A/[0,1,2,3] B/[0,1,2] C/[3,4,5,6,7,8,9] D/[3,4,5] Q4. What would the program below print out? print (x:6]) Ans: A/ [0,1,2,3,4,5,6] B/[0,1,2,3,4,5] C/[6,7,8,9] D/ [5] Q5. What would the program below print out? print(x[0:12]) Ans: A/ [0,1,2,3,4,5,6,7,8,9,10,11,12] B/[0,1,2,3,4,5,6,7,8,9] C/[0,1,2,3,4,5,6,7,8,9,10,11] D/ syntax error Q6. What is the function of append() in Python? Ans: A/To add an element to the front of a list B/ To add an element to the back of a list c/ To delete an element from the front of a list D/ To delete an element from the back of a list Q7. What is the function of pop( ) in Python? Ans: A/To add an element to the front of a list B / To add an element to the back of a list c/ To remove and return an element from the front of a list D/ To remove and return an element from the back of a list

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Finance A Quantitative Introduction Volume 2

Authors: Piotr Staszkiewicz, Lucia Staszkiewicz

1st Edition

0128027975, 978-0128027974

More Books

Students also viewed these Finance questions

Question

Brief the importance of span of control and its concepts.

Answered: 1 week ago

Question

What is meant by decentralisation?

Answered: 1 week ago

Question

Describe your ideal working day.

Answered: 1 week ago