Generate all possible polynomial combinations [closed] - python

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How can i generate all possible polynomials for coefficients of 1..10 and a degree of 10 ?
preferably in Python or ruby .
I have found PythonPoly module , but still dont understand how to make it .
Thanks .

Seems like you want somebody to do your homework for you .
But here you go ...
my_polynomials = itertools.product(range(1, 11), repeat=10)
Then :
for p in my_polynomials:
do_something_with_polynomial(p)

This is a Ruby versioin
my_polynomials = (1..10).to_a.repeated_combination(10)
To print the first 50:
my_polynomials.take(50).each{|mp| p mp}

Related

Insert a word into the middle of a list and print out the modified list [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I'm doing a Computer Science Lab with Python.
I've tried using some functions like s.insert (hot day, warm morning) but this doesn't help me add the value to the middle of the list. Can someone please help me out?
Thanks
Do this using insert
s.insert(index_to_insert, value)
For example:
s.insert(1, "hello") will insert the string "hello" as the second element of the list (since indexing starts at 0)
The problem is that you have s as a string not a list. You must convert to list then do the insertion as follows:
s = s.split()
s.insert(1, "warm")
s = ' '.join(s)

How to match words containing characters and digits, but not numbers? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm trying to create in Python a regular expression that matches words that contains A-Za-z or A-Za-z0-9, but not only 0-9.
For example I want to match fooT, foo23, fo24ooo, fo4o444, but NOT 40.
Is it possible?
One way would be:
r'\w*[A-Za-z]\w*'
\w matches _ as well as 'A-Za-z0-9' - if that's wrong, write out the whole class:
r'[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*'

Want to make a regular expression that matches the following string [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have to make a regexp that matches this:
ORIGIN atcgt --(a dna sequence varying in length)-- //
But my skills aren't that good
You can use this pattern ^[ATCGU]+$
import re
dnpattern = re.compile("^[ATCGU]+$")
print dnpattern.match("ATC").group()

Selecting bindpose nodes [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am having issues selecting all of the bindpose nodes in a scene.
How can I get them?
I am using PyMEL for this particular script.
use
pm.ls( type = 'dagPose')
to get all of the pose nodes in the scene. Then loop through those and check the .bindpose attribute to see if the pose node is a dag pose.
all_poses = pm.ls(type = 'dagPose') or []
bind_poses = [k for k in all_poses if k.bindPose.get()]

Can Python Create 2D Games? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Is it possible to make 2D games using python? If it is got any links to any 2D game that used Python to create it? I was thinking of learning Python but thought i should ask you guys if it can create 2D games before I do start.
Yes, check out http://pygame.org
It's a pretty popular 2D library for Python.
I use pygame myself and it is very good. It has good documentation and tutorials, and is quite well designed. I've also heard wonderful reviews of pyglet.
Relevant

Categories