These tasks are all related to file access.
You are to create a program which will read in text from a file using the sample code below. The name of the text file will be “words.txt” and must be placed in the same place as your code. myfile = open("words.txt", "r") # open file in read mode fullTextFile = myfile.read() # read in […]
You are to create a program which will read in text from a file using the sample code below. The name of the text file will be “words.txt” and must be placed in the same place as your code. myfile = open("words.txt", "r") # open file in read mode fullTextFile = myfile.read() # read in […]
You are to create a program which will read in text from a file using the sample code below. The name of the text file will be “words.txt” and must be placed in the same place as your code. myfile = open("words.txt", "r") # open file in read mode fullTextFile = myfile.read() # read in […]
You have been given a text file containing the following data – bert,32 sally,13 mary,21 bill,25 You must save this data into a text file (with a file name of your choice). Your job is to read in this text file, order it by age (the number) and then output it back to the file […]
Write a simple flash card program which will – Load up flash cards from a file Pick one at random Display the word / idea Wait for a few seconds or for a key press. Then display the answer You need to log in or create an account to submit code!
Write a simple flash card program which will – Load up flash cards from a file Pick one at random Display the word / idea Wait for a few seconds or for a key press. Then display the answer Offer a choice of 4 definitions at random (one is correct) Allow the user to guess […]
You are to write a program which can load and save scores into a file. The file will be structrued as below – 1,masta,5000 2,bert,4325 3,sally,4011 4,sue,3834 5,Les,3731 Each score is on a new line and is made up of the position, name and score. Your program will need to ask for the new score […]
Write a simple flash card program which will – Load up flash cards from a file Pick one at random Display the word / idea Wait for a few seconds or for a key press. Then display the answer Offer a choice of 4 definitions at random (one is correct) Allow the user to guess […]
You need to create a program which will ask the user for a word which has a number of unknown letters. When entering the unknown word into the computer you will use “*” for any unknown letters. For example, if the input was “ha**y” then it should output – hairy handy hanky happy hardy harpy […]
You must create a simple program which will act a bit like notepad! It must – Allow the user to open an existing file and load it all into memory Allow the creation of a file if the specified one does not exist. Allow each sentence to be added one line at a time Add each line […]
Leave a Reply