User Profile

Collapse

Profile Sidebar

Collapse
wagn31
wagn31
Last Activity: Jul 25 '07, 03:51 AM
Joined: Jun 13 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • wagn31
    started a topic using recursion

    using recursion

    new to python and I have this assingment: I need to write a recursive function that takes paramaters (aString,nTimes ) and it needs to print the aString parameter the number of times specified by nTimes. I cannot use a for or while loop, just recursion. How would I go about doing this? all i know how to do is get it started and use recursion to call function again.

    def printNtimes(aSt ring,nTimes):

    I also know how to...
    See more | Go to post
    Last edited by wagn31; Jul 24 '07, 04:14 AM. Reason: added

  • wagn31
    started a topic python cipher using a dictionary

    python cipher using a dictionary

    i need to use a cipher but I have to used the assigned code in the ciphering i know how to do it, but i am not sure how to add my own dictionary. Here is what i have so far:


    [cipher = {"a":"g", "b":"h", "c":"i", "d":"j", "e":"k", "f":"l", "g":"m", "h":"n",
    ...
    See more | Go to post
    Last edited by wagn31; Jun 21 '07, 10:12 PM. Reason: spelling correction

  • wagn31
    replied to decimal to python using recursion
    decimal to python using recursion

    I need to write a code that take a decimal string and turns it into a binary number and i am new at python and have no clue how to do this:
    [CODE=python]
    def print_binary1(d ecimal_string):
    bStr = '0'
    while decimal_string > 0:
    bStr = str(decimal_str ing % 2)
    decimal_string = decimal_string >> 1
    print bStr
    ...
    See more | Go to post
    Last edited by bartonc; Jun 15 '07, 04:57 AM. Reason: Added [CODE=python][CODE] tags.

    Leave a comment:


  • wagn31
    replied to decimal to python using recursion
    [CODE=python]def print_binary1(d ecimal_string):
    bStr = ''
    while decimal_string > 0:
    bStr = str(decimal_str ing % 2)
    decimal_string = decimal_string >> 1
    print bStr
    return bStr
    if decimal_string == 0:
    print bStr
    return bStr
    print_binary1(d ecimal_string )
    [/CODE]
    this is what i have and i know i...
    See more | Go to post
    Last edited by bartonc; Jun 15 '07, 06:26 PM. Reason: Added [CODE=python][CODE] tags.

    Leave a comment:


  • wagn31
    replied to decimal to python using recursion
    yeah i know how to do that but i am new to python and am unsure how the coding goes
    See more | Go to post

    Leave a comment:


  • wagn31
    started a topic decimal to python using recursion

    decimal to python using recursion

    How do I convert a decimal integer to a binary number using a recursive function? I am really stuck on this one. any help?
    See more | Go to post
No activity results to display
Show More
Working...