We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 93bddfb commit 3bf31e2Copy full SHA for 3bf31e2
ailurus1991/.DS_Store
6 KB
ailurus1991/0004/input.txt
@@ -0,0 +1,8 @@
1
+fff sdf sdf
2
+sdf
3
4
+sa
5
+df
6
+as
7
8
+sdSS
ailurus1991/0004/main.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+__author__ = 'jinyang'
+def calcWords(path):
+ file = open(path, 'r')
9
+ inputStr = file.read()
10
+ wordsNum = 0
11
+ for i in inputStr:
12
+ if i == ' ' or i == '\n':
13
+ wordsNum += 1
14
15
+ file.close()
16
+ print wordsNum + 1
17
18
+if __name__ == '__main__':
19
+ calcWords('input.txt')
0 commit comments