• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 1 fuera de 3 páginas
Examen

Intro to Python Exam 2 Questions & Answers.

Document preview thumbnail
Vista previa 1 fuera de 3 páginas

Intro to Python Exam 2 Questions & Answers. Sequences - CORRECT ANSWER objects that can hold multiple items of data in order. You can then perform operations on sequences to examine and manipulate the items stored in them. What sequence types does Python use? - CORRECT ANSWER Lists, tuples Lists are mutable. What does this mean? - CORRECT ANSWER Their contents can be changed during program execution What are the different ways lists can be created? - CORRECT ANSWER [ ] with numbers and/or strings, along with using range (list(range(2, 22, 2))) What are Python's list operations? - CORRECT ANSWER + can join together two lists, * can repeat items in lists, in keyword returns True if item is in list What is the only way to change list items in a loop? - CORRECT ANSWER By index What numbers would you need in a range for 1-20? - CORRECT ANSWER range(1,21) How does slicing work in lists? - CORRECT ANSWER To start from first index [:6] To go to the end of the list [6:] [-5:] can make the list count backwards [:-5] will stop 5 items from end of the list [1::2] will provide a step value, skipping every other value What are the list methods? - CORRECT ANSWER Append, insert, sort, del, index, min/max How does append work in lists? - CORRECT ANSWER Use d to add an item onto the end of a list Ex. d("cats") will add "cats" onto the end of the list How does insert work in lists? - CORRECT ANSWER Adds an item to a particular position Ex. t(0, "cats") will add "cats" to the beginning of the list How does sort work in lists? - CORRECT ANSWER Sorts the list alphabetically (can only be used on all strings Ex. ( ) How does del work in lists? - CORRECT ANSWER Deletes the indexed object Ex. del list1[3] deletes fourth item in list How does index and remove work in lists? - CORRECT ANSWER Must use try and except block Ex. try: ("cats") except(ValueError):

Vista previa del contenido

Intro to Python Exam 2 Questions &
Answers.

Sequences - CORRECT ANSWER objects that can hold multiple items of data in order. You can then
perform operations on sequences to examine and manipulate the items stored in them.



What sequence types does Python use? - CORRECT ANSWER Lists, tuples



Lists are mutable. What does this mean? - CORRECT ANSWER Their contents can be changed during
program execution



What are the different ways lists can be created? - CORRECT ANSWER [ ] with numbers and/or strings,
along with using range (list(range(2, 22, 2)))



What are Python's list operations? - CORRECT ANSWER + can join together two lists, * can repeat items
in lists, in keyword returns True if item is in list



What is the only way to change list items in a loop? - CORRECT ANSWER By index



What numbers would you need in a range for 1-20? - CORRECT ANSWER range(1,21)



How does slicing work in lists? - CORRECT ANSWER To start from first index [:6]

To go to the end of the list [6:]

[-5:] can make the list count backwards

[:-5] will stop 5 items from end of the list

[1::2] will provide a step value, skipping every other value



What are the list methods? - CORRECT ANSWER Append, insert, sort, del, index, min/max

Información del documento

Subido en
6 de abril de 2025
Número de páginas
3
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$12.49

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
ROSEGRADES
3.4
(35)
Vendido
236
Seguidores
87
Artículos
12121
Última venta
4 semanas hace




Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes