Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Write a Python program that Stores App Information in A Text File?

    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 472
    Answer it

    Write a Python program that reads in from a text file. You should briefly prepare a textfile containing information about items sold in a bakery. The information like type of buns,cookies, cakes and more with the price lists should be included.

    Extract the information from the text file and store it into a list. Allow users to select which food they want to buy. Allow them to put in quantity of each item they have chosen. There are some conditions that need to be checked as well. If the user have a membership with the bakery, provide points for each item they have purchased. These points must be stored in another text file. If they already have accumulated certain amount of points, i.e 2000 points, get them to redeem $ 10 voucher. You may specify few other conditions for points redemptions.

    Calculate the total price the customer needs to pay. If the total price exceeds $ 60, provide them with 5% discount, and register them as a free member. This information should be stored in a text file.

 1 Answer(s)

  • Hello viswa nath
    You have to store app information in text file in a list or a tuple. As like below code.

    textname = input("app information in text file")
    thetextfile = open(textname,'shiva')
    print("The file opened successfully !")
    thetextfile = thetextfile.read()
    file_s = thetextfile.split()
    holder = []
    wordlist = {}
    for c in file_s:
       wordlist[c.split()[0]] = c.split()[1:]

    Note- The layout for this UI should be correct.

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: