From 40c6624ad1bac0565aaa59444b01bb45e5daae08 Mon Sep 17 00:00:00 2001 From: shuvojitss <142198651+shuvojitss@users.noreply.github.com> Date: Thu, 19 Oct 2023 18:44:18 +0530 Subject: [PATCH] Create ass11.6.py --- ass11.6.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 ass11.6.py diff --git a/ass11.6.py b/ass11.6.py new file mode 100644 index 0000000..bd580ba --- /dev/null +++ b/ass11.6.py @@ -0,0 +1,20 @@ +words = 0 +line_count = 0 + +with open("home.txt", 'r') as f: + for line in f: + w = line.split() + words += len(w) + line_count += 1 + +print("Total words:", words) +print("Total lines:", line_count) + + +#Total words: 11 +#Total lines: 2 + + +home.txt +I live in Howrah. +The city is beside the river Ganga.