|
||||||
| Python Discussion forum for Python, a high-level language with simple syntax, but yet powerful. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Hi, I just started learning programming and I was told that Python was good for beginners, and after solving just a few problems I'm already stuck...
I'm suppose to make a function that counts down from the number entered and then up again. Using recursion (if). I can make it go either up or down but not both in one function. For example if i enter 4 it should do this: 4 3 2 1 0 1 2 3 4 The next problem is the same but using iteration (while) instead of recursion. I know this must be so easy but the answer eludes me. Thanks! |
| Sponsored Links |
|
|
|
|||
|
you can give another argument in you recursive function that will specify if the counter should go up or down:
Quote:
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Project: ionFiles - Joomla Simple File Download | Jordan | Community Projects | 331 | 11-26-2008 12:35 PM |
| Probably a simple class question | utdiscant | Python | 1 | 06-10-2008 10:10 PM |
| How to style fonts of a text in a simple page? | c0de | Tutorials | 3 | 09-15-2007 11:08 PM |
| Simple PHP/MYSQL guide | Jaan | PHP Tutorials | 0 | 01-07-2007 05:22 PM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |