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
| Use % 100 to get the last two digits of a number | |
| --- 430 % 100 => 30 | |
| Use // 100 to get the first digit of a number | |
| --- 430 //100 => 4 | |
| Use % 10 to get the last digit of a number | |
| --- 430 % 10 => 0 | |
| Conclusion | |
| - Use //10 to get from the left | |
| //10, remove 1 digit from right | |
| //100, remove 2 digits from right |
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
| #first | |
| #- write recursive solution | |
| coins = [50, 20, 10, 5, 1] | |
| count =0 | |
| count2 = 0 | |
| def cc(a,d): | |
| global count | |
| count+=1 | |
| if a <0 or d == 0: | |
| return 0 |
NewerOlder