Hello, everyone
i just start to learn python, but i have some problem of it
can you help me figure it out please?

my problem is

i want to obtain a sensetce and obtain one randomly words from the use
i want to write a prgram which can find out is the randomly words found in the sensetce or not?

thanks a lot~~

You would want to read the string into an array. Split the string at each space, so you have individual words, and feed it into an array. Then use the "random" module to generate a number from 0 to the length of your array. Then, that integer it gives can be used to read a value from the array at that position. Ie, if it gave you 3, you would write, like:
print array[3]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.