Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4cc310c

Browse files
29th april
1 parent a927acf commit 4cc310c

File tree

7 files changed

+33
-0
lines changed

7 files changed

+33
-0
lines changed

‎Vowel Counter from file/employees.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Adama Lee,CAG,30000
2+
Morris Heather, Heroine,0
3+
Lee Bruce, JKD
4+
master, 100000

‎Vowel Counter from file/vowelCounter.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
f = open("employees.txt", "r")
2+
contents = f.read()
3+
vowels = 'aeiouAEIOU'
4+
count = 0
5+
for letter in contents:
6+
if letter in vowels:
7+
count += 1
8+
print("Number of vowels: ", count)

‎employeeWithHighestSalary.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
inputFile = open("employees.txt", "r")
2+
print ("Reading from file inputFile.txt")
3+
for line in inputFile:
4+
name, job, income = line.split(',')
5+
last, first = name.split()
6+
income = int(income)
7+
income = income + (income)
8+
print ("Name: ", first, last, "Job: ", job, "Income: ", income)
9+
print("Completed reading of file")

‎employees.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Adama Lee,CAG,30000
2+
Morris Heather, Heroine,0
3+
Lee Bruce, JKD
4+
master, 100000

‎read.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
myfile = open("sqrt_results.txt", "r")
2+
str = myfile.read()
3+
size = len(str)
4+
print ("Size of the file is: ", size)

‎reading a line using a for loop/read.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
myfile = open("sqrt_results.txt", "r")
2+
for str in myfile:
3+
print(str, end="")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The square root of 3.0 is 1.7320508075688772

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /