The first one is: A program that searches within a file and by user input for a word, and counts how many of this word in the file, and if its in the file or not.
Thats what i reached so far:
sword, line= 0, 0 filename= raw_input("please input file name: ") textf = open(filename, 'r') ask= raw_input("Input the word your looking for: ") for lines in textf: if ask in textf: sword += 1 continue print "number of", sword
The second is: Write a program that prints a histogram. The program will read data from a file, each line of the file contains a number from range 0-10. Your program must count the occurrences of each score and print the score and the count of the score. hint: use list thats stores the count for each possible score.
What i have reached so far is nothing, perhaps someone can help me with a lead so i can continue.
Edited 3 Years Ago by pritaeas: Fixed formatting.