Quote:
Originally Posted by econophile
This may be closer to what you are looking for:
Code:
def searchinlist():
input = raw_input('Enter search string: ')
for item in A:
if item[0:len(input)]==input:
print(item)
Code:
>>> searchinlist()
Enter search string: ABz
ABz(R 0.75)
ABz(L 0.25)
That will help me. Thanks
Is it also possible to include a randomnize function to the searchfunction that will give me a random ouput .
So ABz(R 0.75) means 75% and ABz(L 0.25) means 25%.
I can also change the name of the objects when it makes it easier to implement. Maybe the form ABz(R 75.0) or anyother form is better for this task.
So when i search my list and typ ABz it will give me ABz(R0.75) with a 75% chance and ABz(L 0.25) with a 25% chance.
Maybe something with
[PHP]import random[/PHP]
[PHP]print(random.randint(1,100))[/PHP]
and then compare the 5&6char of ABz(R75.0) which is 75 with the random number. if random number is between 1 and 75 print ABz(R75.0)
if random number is between 76 and 100 print ABz(L 0.25)
their is a maximum of 3 objects that the searchfunktion give out
some examples
so maybe ABz(R50.0) ABz(L25.0) ABz(S25.0)
or ABz(R1.0)
but another question is how to separe stuff like 50,25,25
so that the computer now 50 is 1-50 25 is 51-75 and the other 25 is 76-100
maybe this randominclude is way to difficult i dont know. but perhaps someone has a idea.
regards
Last edited by AsUs91; 10-30-2015 at 02:14 PM.