Professional Documents
Culture Documents
GD Goenka Signature School: Worksheet Iii - Functions & File Handling Class Xii - Computer Science
GD Goenka Signature School: Worksheet Iii - Functions & File Handling Class Xii - Computer Science
7. What is Indentation?
17. Write a function called calculate_area() that takes base and height as input arguments and
returns area of a triangle as an output. The formula used is:
Triangle Area = 1/2*base*height
18. Write the use and syntax for the following methods:
a) open()
b) read()
19. Write the file mode that will be used for opening the following files. Also, write the Python
statements to open the following files:
a) a text file “example.txt” in both read and write mode
b) a text file “try.txt” in append and read mode
20. Differentiate between actual parameter(s) and a formal parameter(s) with a suitable
example for each.