Skip to content

Commit 7cfebed

Browse files
authored
Add files via upload
1 parent b08f333 commit 7cfebed

5 files changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Donkey SANU Donkey Donkey
2+
Donkey Donkey Hassan
3+
Donkeyman Donkey KIng Donkey
4+
Donkey Hello world!
5+
Donkey Hockey
6+
wakey wakey Donkey
7+
Raja Donkey
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
def generate_table(n):
2+
table = ""
3+
for i in range(1,11):
4+
table += f"{n} x {i} = {n*i}\n"
5+
6+
with open(f"tables/table_of_{n}.txt", "w") as f:
7+
f.write(table)
8+
9+
for i in range(2,21):
10+
generate_table(i)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
words = ["bad", "donkey"]
2+
3+
with open("words.txt") as f:
4+
content = f.read()
5+
6+
for word in words:
7+
content = content.replace(word, "#"*len(word))
8+
9+
with open("words.txt", "w") as f:
10+
f.write(content)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
with open("donkey.txt") as f:
2+
x = f.read()
3+
4+
y = x.replace("Donkey", "###")
5+
6+
with open("donkey.txt", "w") as f:
7+
f.write(y)
8+

codes_in_Aug2025/FILE-IO/words.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
The bad donkey kicked the bad
2+
bucket, while another donkey
3+
stubbornly ignored
4+
the bad weather and the bad apples.

0 commit comments

Comments
 (0)