Hey there! Sign in to join this conversationNew here? Join for free
    Offline

    2
    ReputationRep:
    (Original post by bobibycfyvyubb)
    i have been set a task which says,
    "Develop a program that identifies individual words in a sentence, stores these in a list and replaces each word in the original sentence with the position of that word in the list.For example, the sentence ASK NOT WHAT YOUR COUNTRY CAN DO FOR YOU ASK WHAT YOU CAN DO FOR YOUR COUNTRYcontains the words ASK, NOT, WHAT, YOUR, COUNTRY, CAN, DO, FOR, YOUThe sentence can be recreated from the positions of these words in this list using the sequence1,2,3,4,5,6,7,8,9,1,3,9, 6,7,8,4,5Save the list of words and the positions of these words in the sentence as separate files or as a single file.
    Analyse the requirements for this system and design, develop, test and evaluate a program to:
    • identify the individual words in a sentence and store them in a list
    • create a list of positions for words in that list
    • save these lists as a single file or as separate files."
    can someone tell me how to do this in python 2.7.10
    If the sentence is stored in a string, you can easily create a list of words using the split() method. If you read from a file, the input is in the form of a string. You can restore your list of words to a string that can be printed by printing each item within the list using a for loop.

    Why are you still using Python 2.7? Even on an ancient computer like mine I am using Python 3.4.
    Offline

    0
    ReputationRep:
    yes please can i see ur coursework coz i really need help on python task 3 and java task 1,2,3,4
    Offline

    0
    ReputationRep:
    (Original post by tonyhawken)
    If the sentence is stored in a string, you can easily create a list of words using the split() method. If you read from a file, the input is in the form of a string. You can restore your list of words to a string that can be printed by printing each item within the list using a for loop.

    Why are you still using Python 2.7? Even on an ancient computer like mine I am using Python 3.4.
    im using python 3.4 too
    Offline

    1
    ReputationRep:
    Hey, I've done this code but my teacher says that I need to remove punctuation and then output an error message saying that there is punctuatio, but I'm kinda stuck there.

    Any help please?
    Offline

    1
    ReputationRep:
    If you guys really need help, just send me a private message.
    Offline

    0
    ReputationRep:
    (Original post by zxvs)
    You guys still need help? I submitted this coursework like two months ago and got 43/45 (A*).
    Can you help me?
    Offline

    6
    ReputationRep:
    I'm doing the exact same project for summer homework Obviously, I left it until the last minute and now I'm just struggling. The hardest bit for me is analysing, I'm not sure how to do it.
 
 
 
Poll
Do you agree with the PM's proposal to cut tuition fees for some courses?

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.