Wednesday, August 28, 2019

Python assignment Example | Topics and Well Written Essays - 1500 words

Python - Assignment Example Before using methods of a classes that are user defined, it is necessary to create an object which will temporarily hold values returned by the various methods of the associated class. bFiles is created to facilitate calling of the two methods of BrowseFiles. After variable and object declarations and initialization, the files containing the group of words to use for the game are read into the program using the open() method and stored in variables f1, f2, and f3 as shown in the file above. This program has used only three input files, however more files can be reead into the program when a method to read files is defined. The three for loops then loop through each file adding each word to a group according to its file. Once all the files have been loaded into the program and assigned to different groups, suggested management activities can be performed upon them. To browse the groups available, a user is asked to choose one of the groups so that its contents can be displayed. Using the object created BrowseFiles method browseGroups is called and given the user value for the group together with the groups as arguments. It then prints the words under the specified group. Deletion is done in the same way where the delGroup() is called and given the group name to delete. Fig.1.0. illustrates these activities. First important variables are declared: choice holds the string of words entered by user, score holds the number of words from the user choice that are present in the group chosen while score_record holds the score together with the timestamp of when it was created. The game prompts the user to enter the name of the group from which the jumbled words should be extracted. The group is then returned containing the words in reverse. The user is then prompted to enter the words that they can make out from the list. The loop checks each of the words against the original group and increments the

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.