What is the value of x after evaluating the expression x 23

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 ()

Solution

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

 What is the value of x after evaluating the expression \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site