[Tutor] Help on Assginments
To whom it may concern, I need someone to help me to develop programs for the following assignments: 1. Define a new kind of Turtle, TurtleGTX, that comes with some extra features: it can jump forward a given distance, and it has an odometer that keeps track of how far the turtle has travelled since it came off the production line. (The parent class has a number of synonyms like fd, forward, back, backward, and bk: for this exercise, just focus on putting this functionality into the forward method.) Think carefully about how to count the distance if the turtle is asked to move forward by a negative amount. (We would not want to buy a second-hand turtle whose odometer reading was faked because its previous owner drove it backwards around the block too often. Try this in a car near you, and see if the car’s odometer counts up or down when you reverse.) 2. You are to develop a program (name it trivia_game.py) that will play a trivia game with two players. The game will be played this way: Starting with player 1, each player gets a turn at answering 5 trivia questions. When a question is displayed, 4 possible answers are also displayed (1 of the 4 is the correct answer). A correct answer earns the player 1 point. After both players have answered their 5 questions the program will display the number of points earned by each player and declare the player with the most points the winner (or a tie if both players have earned the same number of points). You must write a class (name it Question.py) to hold the data for a trivia question. The class should have the following attributes: A trivia question Possible answer 1 Possible answer 2 Possible answer 3 Possible answer 4 The number of the correct answer (1, 2, 3, or 4) The Question class should have an appropriate __init__ method, accessors and mutators. Your program should have a list or dictionary containing 10 Question objects, one for each trivia question. You are to make up your own trivia questions. Submit both files (zip the two files if possible). Our final exam is a real world problem about efficiency in a warehouse. 3. XYZ Corporation sells products online. The company has a large warehouse in which it stores its inventory of products. Orders are picked, packed and shipped from the warehouse. XYZ Corporation has contracted with you to write a program that will minimize the number of steps that the staff in the warehouse (called ODA's) take in picking the products ordered by customers. The information you will need to complete this assignment are in the following files: Specifications: CTIM285_Summer_2016_FinalExam.pdf Warehouse Map: WarehouseImage.pdf Data for Analysis: warehouse_data_final_exam_Python.txt Data for Analysis is saved in this order on each line of the file: [orderNumber, partNumber, quantyNumber, aisleNumber, shelfNumber, binNumber] Thanks, Justin ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] IDLE Subprocess Startup Error
On Fri, Jul 29, 2016, 2:11 AM Darah via Tutor wrote: > "IDLE's subprocess didn't make connection. Either IDLE can't start a > subprocess or personal firewall software is blocking the connection.” > In the last few days, have you installed any other software? Perhaps something has changed your firewall settings. > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help on Assginments
On 30/07/16 05:31, Justin Korn via Tutor wrote: > ...I need someone to help me to develop programs for the following > assignments: That's not really how tutor list works. We will answer your questions and give you hints when you get stuck. But it is the whole list membership helping you, not a designated "someone". As to your projects here's what I'd recommend. 1) Tackle them one by one, it keeps the email threads separate and the archives easier to search. 2) Make a start, write some code. When you get stuck or something doesn't work as expected, ask here. 3) Always remind us of which OS and Python version you are using 4) If there are error messages send the whole error text not a summary. > 1. Define a new kind of Turtle, ... This one slightly confused me since the standard turtle can already jump forward a given distance. The only new feature appears to be the odometer concept? > 2. You are to develop a program (name it trivia_game.py) that > will play a trivia game with two players. ... > You must write a class (name it Question.py) to hold the data This seems straightforward but a tad tedious creating the data. It would have been nice if they provided a data file! > Our final exam is a real world problem about efficiency in a warehouse. Slightly more challenging but nothing too difficult provided you can do the math and the document provided is sufficiently clear. Based on the questions I assume you have a reasonably good understanding of Python basics including the data structures, functions, classes and objects, files, and how to import and use modules? -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Help on Assignments
To whom it may concern, I need someone to help me to develop programs for the following assignments. I have been working on these assignments for a week and a half, and I can't make any progress. I also been dealing with a sick relative, so please help me out immediately. I use the version 3.4.1. Here are the following assignments and what I have so far: 1. Define a new kind of Turtle, TurtleGTX, that comes with some extra features: it can jump forward a given distance, and it has an odometer that keeps track of how far the turtle has travelled since it came off the production line. (The parent class has a number of synonyms like fd, forward, back, backward, and bk: for this exercise, just focus on putting this functionality into the forward method.) Think carefully about how to count the distance if the turtle is asked to move forward by a negative amount. (We would not want to buy a second-hand turtle whose odometer reading was faked because its previous owner drove it backwards around the block too often. Try this in a car near you, and see if the car’s odometer counts up or down when you reverse.) import turtle class turtle_Turtle(): ts = turtle.Screen() ts.title("TurtleGTX") bob = turtle.Turtle() bob.shape("turtle") bob.color("brown") class TurtleGTX(turtle_Turtle): odometer = 0 def forward(x): if (x >= 0): i = 0 while (i < x): self.fd() odometer += 1 i+=1 else: i = 0 while (i > x): self.bk() odometer +=1 i-=1 print ("Odometer is", odemeter) my_turtle = TurtleGTX() my_turtle.foward() 2. You are to develop a program (name it trivia_game.py) that will play a trivia game with two players. The game will be played this way: Starting with player 1, each player gets a turn at answering 5 trivia questions. When a question is displayed, 4 possible answers are also displayed (1 of the 4 is the correct answer). A correct answer earns the player 1 point. After both players have answered their 5 questions the program will display the number of points earned by each player and declare the player with the most points the winner (or a tie if both players have earned the same number of points). You must write a class (name it Question.py) to hold the data for a trivia question. The class should have the following attributes: A trivia question Possible answer 1 Possible answer 2 Possible answer 3 Possible answer 4 The number of the correct answer (1, 2, 3, or 4) The Question class should have an appropriate __init__ method, accessors and mutators. Your program should have a list or dictionary containing 10 Question objects, one for each trivia question. You are to make up your own trivia questions. Submit both files (zip the two files if possible). trivia_game.py import sys import random import Question.py questions = [ Question("How many states start with the letter M", 3, ["6", "7", "8", "9"]), Question("What is the area of a right triagle with a hypotenuse of 10 and an altitude of 8", 1, ["24", "40", "48", "80"]), Question("Which physics quantity is not a vector", 4, ["Acceleration", "Momentum", "Torque", "Work"]), Question("How many inches are in a foot", 2, ["6", "12", "18", "24"]), Question("Who does not play in the NFL anymore", 3, ["Frank Gore", "Richard Sherman", "Peyton Manning", "Antonio Gates"]), Question("What is a bakers dozen equivalent to", 4, ["10", "11", "12", "13"]), Question("Which city has a NBA team", 1, ["Sacramento", "Baltimore", "St. Louis", "Pittsburgh"]), Question("Which of the following elements have eleven protons", 4, ["boron", "sulfur", "floruine", "sodium"]), Question("What is the minimum age to run for president of the United States", 2, ["30", "35", "40", "45"]), Question("Who won super bowl 44", 1, ["New Orleans Saints", "Pittsburgh Steelers", "Minnesota Vikings", "Indianapolis Colts"]) ] random.shuffle(questions)# Randomize the order of the questions for question in questions: question.ask() Question.py 3. Our final exam is a real world problem about efficiency in a warehouse. XYZ Corporation sells products online. The company has a large warehouse in which it stores its inventory of products. Orders are picked, packed and shipped from the warehouse. XYZ Corporation has contracted with you to write a program that will minimize the number of steps that the staff in the warehouse (called ODA's) take in picking the products ordered by customers. The information you will need to complete this assignment are in the following files: Specifications: CTIM285_Summer_2016_FinalExam.pdf Warehouse Map: WarehouseImage.pdf Data for Analysis: warehouse_data_final_exam_Python.txt Data for Analysis is saved in this order on each line of the file: [orderNumber, partNumber
Re: [Tutor] Help on Assignments - Turtle
On 30/07/16 16:28, Justin Korn via Tutor wrote: > I have been working on these assignments for a week and a half, > and I can't make any progress. I also been dealing with a > sick relative, so please help me out immediately. While I sympathise with your circumstances we are all volunteers here so the help you receive will be at the speed that suits the members. I will address your two assignments in separate mails. > import turtle > class turtle_Turtle(): > ts = turtle.Screen() > ts.title("TurtleGTX") > bob = turtle.Turtle() > bob.shape("turtle") > bob.color("brown") I'm not sure what you think this is doing but I'm pretty sure its not what you want. You are basically defining a couple of class variables and nothing else... > class TurtleGTX(turtle_Turtle): I would have expected you to inherit from turtle.Turtle rather than turtle_Turtle. The latter has no methods and only two class variables. So your GTX class likewise has no inherited methods, you will need to define all of its behaviour. > odometer = 0 This is a class variable meaning it is shared by all turtles. I suspect you really want it to be an instance attribute, which means defined within an __init__() > def forward(x): The first parameter of a class method is usually called self because it will refer to the active object. In this case your x will be the object, whereas I think you want it to be the distance to move? But if so x is a bad choice of name since it implies horizontal direction only > if (x >= 0): > i = 0 > while (i < x): > self.fd() > odometer += 1 > i+=1 This is a horribly inefficient way of saying if x>=0: self.fd(x) odometer += x But it won't work because a) You didn't inherit from turtle so you don't have a fd() method b) Even if you had it requires an input value for its distance so should be self.fd(1) > else: > i = 0 > while (i > x): > self.bk() > odometer +=1 > i-=1 Again a very inefficient alternative to else: x = -x self.bk(x) odometer += x > print ("Odometer is", odemeter) Do you really want to print that every time the turtle moves? > my_turtle = TurtleGTX() > my_turtle.foward() You misspelled forward and failed to give it an x value. Please send real code and/or any error messages. This code could never have run so you should have errors. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help on Assignments - trivia game
On 30/07/16 16:28, Justin Korn via Tutor wrote: > trivia_game.py > import sys > import random > import Question.py You do not include the .py extension in an import statement. It should read import Question Also by convention modules use lowercase names. > questions = [ > Question("How many states start with the letter M", 3, ["6", "7", "8", > "9"]), You are trying to instantiate a Question object but it is (presumably) defined in the question.py class which you import. If so you need to prefix it with the module name like so Question.Question(...) > Question("What is the area of a right triagle with a hypotenuse of 10 and > an altitude of 8", 1, ["24", "40", "48", "80"]), > Question("Which physics quantity is not a vector", 4, ["Acceleration", > "Momentum", "Torque", "Work"]), List indices start from zero so your highest index should be 3. Assuming you intend to use the '4' as an index to the correct answer? > Question("Who won super bowl 44", 1, ["New Orleans Saints", "Pittsburgh > Steelers", "Minnesota Vikings", "Indianapolis Colts"]) > ] > > > random.shuffle(questions)# Randomize the order of the questions > > for question in questions: > question.ask() > > Question.py ??? I'm expecting a class definition here with at least __init__() and ask() methods. And it needs to store the question, possible answers and correct answer somewhere too? -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor