Please take the time to read How to get help on the Dynamo forums
You cant just paste code together and expect a result - start by eliminating repeated imports and save them all at the top
If you’re looking to learn try this course Python Programming MOOC 2024
And if you have some coding experience go here Dynamo Python Primer