This was causing your second error the original team name was been overwrote so your originally entered value was no longer available.Īlright, I figured out the biggest problem that no one on this thread pointed out: I had to strip and split the lines! When I printed the file in its original form, it was all one single block with a bunch of '\n' between each team. You reused the variable team in the for loop. Otherwise the count would have been the number of items in the file. You also need to comparing the text entered into the team variable to the loops variable. (Changing this causes result to no longer to be needed so the rest of the program was updated accordingly with counter.) You needed to reuse counter so it incremented on each iteration. But each iteration of the loop did the same thing so the count would be 1. Then in the loop you are performing counter 1 then assigning it to result. Print("The", team, "won the world series", counter, "times between 19.") Print("The", team, "won the world series", counter, "time between 19.") If counter = 1: # Finally, print the results Winners = infile.readlines() # Read the contents of the file into the list I have worked the other peoples answers into a complete piece of code def main(): Two things: Not only did I NOT type in the Philadelphia Phillies, but the count is incorrect because the Phillies won the World Series twice (19), and thus the team's name appears twice in the text file (and yes, I checked to make sure). The Philadelphia Phillies won the world series 1 time between 19. Print("The", team, "never won the world series.")Īnd this is what happens when I press F5: > Print("The", team, "won the world series", result, "times between 19.") Print("The", team, "won the world series", result, "time between 19.") If result = 1: # Finally, print the results Team = input('Enter the name of a team: ') # Enter name of a baseball teamĬounter = 0 # If said team won a game, count how many times Infile.close() # Always remember to close the file Winner = infile.readlines() # Read the contents of the file into the list Infile = open('WorldSeriesWinners.txt', 'r') # Open the file # and then displays the number of times that team had won the World Series This is my code: # Write a program that lets the user enter the name of a team I think I'm pretty close to solving the problem, save for one logic error. The Lakeland Tigers never won the world series. The New York Yankees won the world series 26 times between 19.Įnter the name of a team: Lakeland Tigers = RESTART =Įnter the name of a team: New York Yankees The Chicago Cubs won the world series 2 times between 19. The program should look like this: Enter the name of a team: Chicago Cubs The program is required to use a list to read in the data and for in Write a program that lets the user enter the name of a team and thenĭisplays the number of times that team has won the World Series in the Won in 1903, and the last line is the name of the team that won in (The first line in the file is the name of the team that This file containsĪ chronological list of the World Series winning teams from 1903 Want to see inside this program? Download the sample packet or watch the video below to peek inside this program."In the module is the file WorldSeriesWinners.txt. Required Encyclopedias: The Kingfisher Science Encyclopedia and The Usborne Science Encyclopedia.Topics Covered: Genetics, Ecology, Plants, Invertebrates, Vertebrates, The Human Body.(Note - If you plan on using this program in a school or co-op, please email us for custom pricing information.) Program Details The guide also gives tips on how to lead your student through the program, comprehension questions, answers for the student's work, and unit tests for you to use. Guide your students through learning about biology! Our Biology for the Logic Stage Teacher Guide contains the student assignments sheets plus 2 day and 5 day schedules to help you plan out the year. Each of the student assignment sheets contains the weekly topic, sketch assignment, experiment directions, report options, dates to enter, and memory work. Hudson is a good writer, and the two spines that go along with the program are colorful, detailed, and easy-to-read and absorb.” Review by Small World at Homeįoster independently learning in your middle school student! Our Biology for the Logic Stage Student Guide includes all student assignment sheets, sketches, experiment sheets, and blank report pages that they will need to complete the year. “ I can’t emphasize this enough: the program is well organized and easy to navigate. These classical science plans will help you teach biology to middle school students!īiology for the Logic Stage leads the middle school student through a study of plants, animal life, and the human body by digging deeper into what was studied during the elementary years.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |