Tests build confidence. Write 'em. They'll save your ass, and they'll let you take a chainsaw to your code without being afraid of unintended consequences.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Newbie programmer | |
| def factorial(x): | |
| if x == 0: | |
| return 1 | |
| else: | |
| return x * factorial(x - 1) | |
| print factorial(6) | |
| #First year programmer, studied Pascal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :⌉ | |
| =⌉ | |
| ¦-) as opposed to | | |
| ☺ | |
| ☹ | |
| ☻ | |
| ⍣ | |
| ⍤ | |
| ⍥ om nom nom | |
| ⍨ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Tower of Hanoi | |
| //No of calls made for n disks is equal to pow(2,n) -1. | |
| void hanoi(int n, char a, char c, char b) | |
| { | |
| if(n==1) | |
| { | |
| printf("\nShift disk 1 from %c to %c",a,c); | |
| return ; | |
| } |
NewerOlder