read text files

icon picker
internet domain names

assignment: read text file, use substring
This is a assignment program
Read a list of values from a text file
Use substring to select some letters from a text value
the comments in the code are minimal, refer to previous projects

constructs used


file handling
open file
read file
close file

data structure
• string array
control structure
fixed loop using index
if conditional
substring function
startswith function

input requirements


Sample data from file, file names including the file type extension

output requirements


display all domains and the length of the domains
display first two characters only for all domains
display last four characters only for all domains
display the full domain name of .com domains only
display the full domain name of domains which have exactly 3 letters after the dot
(how can you identify them?)

design: main steps

you will have to refer to the previous tasks for refinements for each main step

code: repl project

Loading…
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.