Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Document preview thumbnail
Vista previa 2 fuera de 5 páginas
Examen

ENGR 102 Exam 2 Questions and Answers Graded A+

Document preview thumbnail
Vista previa 2 fuera de 5 páginas

ENGR 102 Exam 2 Questions and Answers Graded A+

Vista previa del contenido

ENGR 102 Exam 2 Questions and
Answers Graded A+

File I/O - Correct answer-<fileID> = open("<File Name>", "<designator>")

File I/O: what is the designator for? - Correct answer-Designator is either "r" for

reading or "w" for writing to a file

Part 1) Functions available after successfully opening a file - Correct answer-to

read a line from a file that is open for reading: readline( ).




*Syntax for readline( ) function:

<string variable> = <fileID>.readline()




This returns a string from where the file pointer is at the beginning of the call until

a newline character is found.

Part 2) Functions available after successfully opening a file - Correct answer-If we

successfully open a file for writing,


©COPYRIGHT 2025, ALL RIGHTS RESERVED 1

, then we can use the following function syntax to write a string to a file:




<fileID>.write(<string to write>)

%10.5f or %d to format specifiers to take care of the numbers

Modules - Correct answer-Common Modules:




import matplotlib.pyplot as plt

import numpy as np

import math

Calling Functions - Correct answer-<function>(<arguments>)

ex: print( ), sqrt( ), etc




Dot Format for file I/O

A.<function>(<arguments>)




The name before the dot is an object of a particular type


©COPYRIGHT 2025, ALL RIGHTS RESERVED 2

Información del documento

Subido en
12 de diciembre de 2025
Número de páginas
5
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$11.99

¿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.
EmillyCharlotte
3.5
(31)
Vendido
145
Seguidores
5
Artículos
12467
Última venta
5 horas 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