|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Python recursion function help
hello all
i am really stuck on how to write a recursive function dec2base(n, b) that returns the list of base b digits in the (decimal) number n. Examples: dec2base(120, 10) => [1,2,0] (1x102 + 2x101 + 0x100) dec2base(273, 8) => [4,2,1] (4x82 + 2x81 + 1x80) dec2base(61, 2) => [1,1,1,1,0,1] (1x25 +1x24 +1x23 + 1x22 + 0x21 + 1x20) could someone please help me to get started ![]() |
|
#2
|
|||
|
|||
|
actually, don't worry, i figured it out
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Python recursion function help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|