Question
Define the variables x and y as lists of numbers, and z as a tuple. x=[1, 2, 3, 4, 5] y=[11, 12, 13, 14, 15]
Define the variables x and y as lists of numbers, and z as a tuple.
x=[1, 2, 3, 4, 5] y=[11, 12, 13, 14, 15] z=(21, 22, 23, 24, 25)
(a) What is the value of 3*x? (b) What is the value of x+y? (c) What is the value of x-y? (d) What is the value of x[1]? (e) What is the value of x[0]? (f) What is the value of x[-1]? (g) What is the value of x[:]? (h) What is the value of x[2:4]? (i) What is the value of x[1:4:2]? (j) What is the value of x[:2]? (k) What is the value of x[::2]? (l) What is the result of the following two expressions? x[3]=8 print x (m) What is the result of the above pair of expressions if the list x were replaced with the tuple z?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started