CMPSC 132 midterm(Complete solutions)
Shell mode correct answers A style of using Python where we type expressions at the command prompt, and the results are shown immediately. Contrast with source code, and see the entry under Python shell. Program mode correct answers write an entire program by placing lines of Python instructions in a file and then use the interpreter to execute the contents of the file as a whole interpreters correct answers source code---interpreter---output compilers correct answers source code--compilers--object code--executor--output Blocks of code are denoted by line indentation, which is ______enforced. correct answers rigidly A Python identifier correct answers name used to identify a variable, function, class, module or other object. mutable objects correct answers they can be altered in place i.e(int, float) immuttable objects correct answers cannot be changed in place i.e(list, dict) Aliases correct answers Multiple variables that contain references to the same object. Slicing correct answers Selecting a portion of a collection [:end] correct answers gets the first characters up to but not including end [begin:end] correct answers gets the characters from begin up to but not including end [begin:] correct answers gets the characters from beginning to the end of the string (substr) correct answers returns the index of the first occurence of substring str ce(old, new) correct answers returns a copy of str with all occurrences of old replaced with new (delimiter) correct answers returns a list of substrings from str delimited by delimiter (iterable) correct answers returns a string that is the concatenation of all the elements of iterable with string between each element () correct answers returns a copy of str with leading and trailing whitespace removed
Información del documento
- Subido en
- 29 de mayo de 2024
- Número de páginas
- 11
- Escrito en
- 2023/2024
- Tipo
- Examen
- Contiene
- Preguntas y respuestas