#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2017
    Posts
    85
    Rep Power
    1

    [Python 3] Prompt Saver/Loader, help needed!


    Hey Python Programmers...

    How can i create an command prompt in python 3, thad my users can start an project
    to give it an name as example this:

    Code:
    # JCads Prompter - By Jamie van Cadsand:
    
    prompt_projectGet = str(input("Choose 'New' or 'Load': "))
    prompt_projectName = str(input("Project Name: "))
    prompt_projectStart = str(input("Choose bewteen '+', '-' or 'x'...: "))
    
    if(prompt_projectGet = 'New'):
        prompt_projectGet = 'New'
        pStart():
    elif(prompt_projectGet = 'Load'):
        # Load your project from the foldername with the given project name...
    else:
        print("Error: We don't support other chooses... quit JCads Prompter....")
        quit()
    
    
    
    def pStart():
        if(prompt_projectStart == '+'):
            prompt_projectStart = '+'
            startCalculatePlus()
        ....


    I know how i can working with if startuments....... but now the problem...

    - How can i create an prompt loader or saver like this and the code above ?...:
    Code:
    prompt_projectSave = str(input("Do you want save our project ?... 'Yes' or 'No': "))
    
    if(prompt_projectSave == 'Yes'):
        prompt_projectSave = 'Yes'
        # Save your project... with the at begin gived project name
    elif(promot_projectSave == 'No'):
        # Further with your project...
    else:
        print("Error: we don't support this!... quit JCads Prompter")
        quit()



    I get help needed to understand how i can create an easy project saver and loader
    for an prompt, writted in the current version of python 3.......

    Can anyone help me with my wish ?... to give an code so simple as possible ?...

    Thanks for help, Jamie.
  2. #2
  3. Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Aug 2011
    Posts
    5,971
    Rep Power
    509
    I cannot tell what you want. Sorry.

    However, I'll recommend some changes to this bit of code and request that you look for similar instances having the same issues in the rest of the post.
    Code:
    if(prompt_projectGet = 'New'):
        prompt_projectGet = 'New'
    = is an assignment operation, and is illegal as the logical test in an `if' statement.
    == tests equality

    if prompt_projectGet == 'New':
    # then you already know that the variable prompt_projectGet holds the object 'New'. Reassignment to the same thing is not helpful.

    Parenthesis about the logical expression in the `if' statement are not required. This is python, not c. Of course, this is a matter of choice and you can keep them if they please you. After all, I write lists and tuples with optional trailing comma.
    [2, 3, 5,] # because I like to

    Consider the interaction of your project driver. Suppose the user applies considerable effort to the project, and then at the end they mistype their "Yes" answer to save the project. They'll be angry! You could at least always save the project in a temporary location and tell them a quick recovery plan.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo