What is the value of x after evaluating the expression \"x = 2/3\"? (true/false)
ID: 3925660 • Letter: W
Question
What is the value of x after evaluating the expression "x = 2/3"? (true/false) All of the items in a Python list must be of the same type. If x = "hello world", write an expression to return the substring "wor". Given the dictionary: y = {"type": "DNA", "sequence": "GCGAACTACGT", "feature": "none"} Write an expression to change the value of "feature" to "regulatory". Write a Python function named "print_string" which takes a single str argument as input and prints the message: "OUT: " For example: In [1] print_string('foo') OUT: foo Write an expression to add the number "3" to a list named "sizes". What is the output of the command: ['one', 'two', 'three'].pop().upper ()Explanation / Answer
12)
x = 2/3 is zero. intgers in both numerator and denominator results in only integer(quotient of the division).
13) false.
All items in the python lis can be of any type.
example list = [1,'a',"name"]
14) x = "hello world"
sub = x[6:9]
this method is slicling. x[a:b], a is the starting index, b is the ending index of subpart.
15) y["feature"] = "regulatory"
this is similar to that of list indexing.
16)def print_string(str):
print "OUT:",str
print_string('foo')
# sample output
# OUT: foo
17)sizes = []
sizes.append("3")
# append adds element to list named sizes.
18) output: THREE
pop() method returns and removes the last element in the list i.e. three
upper() method converts the given string to upper case. i.e. THREE
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.