Closed Thread
Results 1 to 3 of 3

Thread: Python 3000 help

  1. #1
    deer dance's Avatar
    deer dance is offline Learning Programmer
    Join Date
    Feb 2009
    Location
    Indiana
    Posts
    40
    Rep Power
    0

    Python 3000 help

    I'm new to Python and I cannot figure out how to use if statements and I'm growing desperate

    Could someone with some more experience in the language help me out?

    Here's the code I'm using
    Code:
    # mOS Beta v0.1
    
    help1 = HELP
    dir1 = DIR
    
    input("Enter Command: ")
    # HELP Command
        if(help1)
            print("Common Commands:\n")
            print("HELP - list common commands")
            print("DIR - open directory navigator")
    # Directory Manager        
        elif(dir1)
            input("Specify Directory: ")
            in input("Select file or folder: ")
            in input("Select file or folder: ")
            in print("Opening file...")
        else print("Improper Command; Type [HELP] for a list of common commands")
    input()
    Ameteur programmer
    HTML Expert
    Official Lunatic

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    PythonPower's Avatar
    PythonPower is offline Programming Professional
    Join Date
    Feb 2009
    Posts
    228
    Rep Power
    13

    Re: Python 3000 help

    Something like this? (See this for more information.)

    Code:
    # Input a command into the variable 'command'
    command input('Enter a command: ')

    # If 'command' = "help"
    if command == 'help':
        print(
    'Commands available:\n\nhelp\ndir\n...')

    # If 'command' = "dir"
    elif command == 'dir':
        print(
    'You are in root directory.')

    # Not a valid command
    else:
        print(
    'Improper command - see help for complete list.'

  4. #3
    deer dance's Avatar
    deer dance is offline Learning Programmer
    Join Date
    Feb 2009
    Location
    Indiana
    Posts
    40
    Rep Power
    0
    Thank you. Unfortunately I can't test it now but when I get the chance I'll let you know how it goes

    As for this:
    Code:
    \n\nhelp\ndir\n...
    I know that '\n' is the new line escape, but as for the rest, what is it?

    I've also seen that documentation, but I couldn't make heads or tails of that thing.

    Nope. Didn't work.

    Is that possibly Python 2.5 or 2.6?

    Either way, Py3k is absolutely not backwards-compatible with and version of Python 2.

    I've looked at the Python 3000 documentation and edited it to resemble the if statment example, yet still no dice. I'd post the current code, but I'm once again on my iPod.

    Nope. Didn't work.

    Is that possibly Python 2.5 or 2.6?

    Either way, Py3k is absolutely not backwards-compatible with and version of Python 2.

    I've looked at the Python 3000 documentation and edited it to resemble the if statment example, yet still no dice. I'd post the current code, but I'm once again on my iPod.
    Last edited by WingedPanther; 02-11-2009 at 04:20 AM. Reason: Quadrupal posting
    Ameteur programmer
    HTML Expert
    Official Lunatic

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Advanced Python, part 1: Extending Python with C
    By spyder in forum Python Tutorials
    Replies: 0
    Last Post: 07-31-2010, 09:36 AM
  2. Replies: 11
    Last Post: 07-31-2010, 12:52 AM
  3. Power Of Python - What Has Been Written In Python?
    By Raja Sekharan in forum Python
    Replies: 7
    Last Post: 02-02-2009, 11:55 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts