a.behrens@server2:~/python_lab$ python3 lab2.py
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): 1
--- Contents of myfile.txt ---
Hello World
This is a test
------------------------------
Press Enter to continue...
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): 2
Enter a filename: myfile.txt
Line count for 'myfile.txt': 2
Press Enter to continue...
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): 3
Enter a filename: myfile.txt
4-letter word count in 'myfile.txt': 2
Press Enter to continue...
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): 4
Enter a filename with integers (one per line): numbers.txt
Average: 2.3333 (from 3 numbers)
Press Enter to continue...
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): 5
--- Directory listing (.) ---
myfile.txt
numbers.txt
----------------------------
Press Enter to continue...
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): 6
Enter a filename: dwkod
Error: dwkod not found.
Press Enter to continue...
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): 6
Enter a filename: numbers.txt
--- Contents of numbers.txt ---
1
2
three
4
-------------------------------
Press Enter to continue...
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): 7
Enter a filename: hi
Enter a word to search: hi
Error: hi not found.
Press Enter to continue...
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): 7
Enter a filename: numbers.txt
Enter a word to search: woej
Word 'woej' appears 0 time(s) in 'numbers.txt'.
No matching lines found.
Press Enter to continue...
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): 7
Enter a filename: myfile.txt
Enter a word to search: Hello
Word 'hello' appears 1 time(s) in 'myfile.txt'.
Found on line(s): 1
Press Enter to continue...
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): 8
Enter a filename: numbers.txt
Enter line to append: 305
Successfully appended to 'numbers.txt'.
Press Enter to continue...
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): 9
Enter a filename: numbers.txt
File Info: numbers.txt
Size: 17 bytes
Last modified: 2026-09-12 18:17:45
Press Enter to continue...
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): 6
Enter a filename: numbers.txt
--- Contents of numbers.txt ---
1
2
three
4
305
-------------------------------
Press Enter to continue...
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): 0
Goodbye!
a.behrens@server2:~/python_lab$ python3 lab2.py
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): 9
Enter a filename: dasjijoj
Error: dasjijoj not found.
Press Enter to continue...
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): jokjoij
Invalid choice. Please enter a number from 0 to 9.
Press Enter to continue...
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): 8
Enter a filename: myfilewoewk
Enter line to append: a
Successfully appended to 'myfilewoewk'.
Press Enter to continue...
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): 6
Enter a filename: myfilewoewk
--- Contents of myfilewoewk ---
a
-------------------------------
Press Enter to continue...
==============================
Lab 1 - Python (Beginner)
==============================
1) Display myfile.txt
2) Count lines in a file
3) Count 4-letter words in a file
4) Average of integers from a file
5) List current directory
6) Show file if it exists
7) Search for a word in a file
8) Append a line to a file
9) Show file info
0) Quit
Choose an option (0-9): 0
Goodbye!