Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSC A08 TERM TEST #1 Question 5. 5 MARKSs] Please write the code for the following function: def total_comments(file_name): (file) -> int file_name: String file_name

image text in transcribed
CSC A08 TERM TEST #1 Question 5. 5 MARKSs] Please write the code for the following function: def total_comments(file_name): (file) -> int file_name: String file_name return: the number of lines in file-name containing at least one # comment Example: If file called "song.txt" contains the following: This is the song that never ends # Yes it goes on and on my friends Some people started singing it # Not know what it was # said Ilir And they'll continue singing it forever just because... Then total-comments("song . txt") -2 >>> total.comments ("song.txt") 2 # Your code goes here

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions

Question

What is the growth rate of GDP per capita?

Answered: 1 week ago