Python Forum
John Guttag Book - Finger Exercise 4 - need help to make the code better
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
John Guttag Book - Finger Exercise 4 - need help to make the code better
#9
(Feb-13-2018, 03:01 PM)sparkz_alot Wrote:
(Feb-13-2018, 10:26 AM)pritesh Wrote: Now on a more generic note, here's some issues I have observed with my programming technique/method. I would be thankful if someone could let me know how to circumvent these issues

I don't think you're ever going to reach a point where you circumvent these issues. I know I go through your 3 steps all the time. In some cases, I spend more time trying to break my code than I spent creating it. Case in point, when I asked you above if you could use the abs() function, I thought I had the perfect solution, then this morning I thought "wait, that was to easy, what did I miss", so this morning I tried the one sequence I hadn't thought of last night, and sure enough I broke the code. By the way, I had 4 'print' functions not necessary for the script, but just so I could see what the 'program' saw. The 'print' function is probably one of the best tools the programmer has.

Since you seem satisfied, I'll go ahead and post this link Finger Excersise 2, you will have to scroll down almost to the end (a post by Archery1234), which also highlights the fact that there can be more than one solution to a problem.

Congratulations on solving the exercise. Onward and upward.

Hi,
Glad to know I am not the only one who is facing these 3 issues. :)

As for the code solution by Archery1234, it's far more elegant and succinct than mine. One day, I will write something as good as that, but till then, I will have to live with my own overly verbose code. Big Grin
Reply


Messages In This Thread
RE: John Guttag Book - Finger Exercise 4 - need help to make the code better - by pritesh - Feb-13-2018, 09:20 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  py4e book exercise not working when compiled adriand 11 8,989 Jul-01-2020, 08:42 AM
Last Post: tawhidbd1248
  [split] help me make this code better please (basic) Rustam 2 2,288 Jun-19-2020, 01:27 PM
Last Post: Rustam
  How to make this dictionary-generating code more efficient? Mark17 4 2,398 Oct-08-2019, 07:42 PM
Last Post: Mark17
  Book exercise in lists sonedap 17 7,152 Feb-03-2019, 08:37 PM
Last Post: ichabod801
  Creating code to make up to 4 turtle move simultaneously in a random heading J0k3r 3 5,525 Mar-05-2018, 03:48 PM
Last Post: mpd
  How to make faster this code Ace 1 2,992 Oct-23-2017, 12:11 PM
Last Post: Larz60+
  How can I make faster that code BlueEva00 1 2,709 Oct-18-2017, 03:51 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020