User Profile

Collapse

Profile Sidebar

Collapse
theroflchopper
theroflchopper
Last Activity: Oct 30 '09, 05:08 PM
Joined: Oct 7 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • theroflchopper
    started a topic Python run times

    Python run times

    I have to state running times using the big-O notation. I'm not sure how you do this

    Code:
    x = 0
    a = 6
    b = 6
    c = 1
    for i in range(2*n):
         x = x + c
         c = c + b
         b = b + a
    print x
    Could someone give me a hint on how I should approach this problem?
    See more | Go to post
    Last edited by bvdet; Oct 23 '09, 10:32 PM. Reason: Changed quote tags to code tags

  • theroflchopper
    started a topic Need a hint with problem

    Need a hint with problem

    Ok I'm having a error with my program. Which finds and displays all positive factors of an input integer. I either get it listing 1 factor num times or an error that I can't divide by zero but I don't know why.

    Code:
    # User input
    num = int(raw_input("Determine the factors of what number ? "))
    
    # Display factors in one line
    print "The factors are:",
    
    # Variable set
    test = 1
    ...
    See more | Go to post
    Last edited by bvdet; Oct 23 '09, 08:20 PM. Reason: Add code tags

  • theroflchopper
    replied to Number to string
    Yeah sor I haven't review python quite enough. I got it to work but it won't go over 21. But thanks I think I could figure it out myself now.

    Code:
    while True:
        import time
        print "Testing word calculator v.1"
        time.sleep(1) 
        S = input("Enter first number to be added: ")
        S2 = input("Enter second number to be added: ")
        num = S + S2
        numDict1
    ...
    See more | Go to post

    Leave a comment:


  • theroflchopper
    replied to Number to string
    Ok but lets say I want to make a simple calculator that adds two numbers and outputs the word. I'm not sure how to incorporate the above into the output.
    See more | Go to post

    Leave a comment:


  • theroflchopper
    started a topic Number to string

    Number to string

    How would I change the output of my python program from being a number to being a string. In the simplest and best way

    For example: instead of 1 it being "one"

    This is probably a stupid question but I can't think of anything
    See more | Go to post
No activity results to display
Show More
Working...