-
For each of the following snippets of Python code, give what would be printed to the command line if run. If the snippet will not print anything because of an error, just put error.
-
a_string = "abcd" a_index = a_string.find("b") print(a_string[a_index:] + a_string[:a_index])
-
a_string = "abcd" for character in a_string: print(chr(ord(character) + 1))
-
a_string = "abcd" a_length = len(a_string) for i in range(a_length): print(a_string[i] + a_string[a_length - i - 1])
-
accumulator = 1 while(accumulator < 10): accumulator *= 2 print(accumulator)
-
a_string = "my string!" while(len(a_string) > 3): a_string = a_string[:-1] print(a_string)
-
a_string = "abcd" b_string = "" index = 0 while index <= len(a_string): b_string = a_string[index] + '-' index = index + 1 print(b_string)
-