What a mess Python is. Noggano - python, what a mess lyrics

Tim and the little one were carried home through the dark courtyards.
Turley about the seas and Miami.
Turley about the nine and the new Java.
It was summer with mosquitoes outside.

They spoke and then remained silent.
Then they talked again about what they were talking about at the beginning.
About the fact that it would be nice to set sail from here.
Is it sad or funny?
This? It is sad.

Suddenly, a company appeared from around the corner.
A face the boys had not seen before.
Should I smoke? Do you have a call?
Where are you from, why don’t you smoke at all?
Don't be rude to me! Long don't move!
What are these greyhounds, who is signing for you?

While the tert was walking, the fellow rushed at full speed.
About six people ran after him.
Timofey remained standing with the others.
We will take everything you have for this.

The cormorants rained down dirty words.
But Timofey stood and thought, is it you?
From behind the garages, a chase appeared.
They didn’t catch up with the little one, or they left the little one there.
And suddenly the scream crashed into the concrete.
What are you waiting for, long f*ck, Python!!!

Tim immediately understood who was the long one and who was the Python.
A blow to the face with a fist, everything turned white with milk.
Calling yourself a python, well, you have to be an asshole.
Tim was trampled, someone pulled the phone.

Someone pulled the wallet, documents and money.
They tore off the Armani slippers.
They blew it fiercely, like snowstorms blow spruce trees in the North.
The fuck? 15 bodies trampling on one body.

When Tim came to his senses, it was already dawn.
There was a guy sitting nearby, and some guys from the area.
What's the point of saying this when your face is like a soccer ball?
We took Tim home, no time for pumping today!

Tima eats soup through a straw and pisses on blood.
He goes for walks with a cane.
He keeps a keen eye on the area from his balcony.
- Where to find Python.

They are mulling over the plan of the house, like in the General Staff.
They are talking about retribution and its scale!
Sanya the karateka and his brother pulled up.
These brothers are enough to take them out!

A crowd of about 40 people had gathered.
80 tough sneakers.
In one of the courtyards there were children sitting,
And Timokha immediately moved to ram.

He looks through the cracks in his swollen face as if through a sight.
Timyn's patsiks keep this bunch in a ring.
- Hello, Python! Timofey blurted out loudly,
But no one responded to this strange nickname.

It was dark then, and Tim didn’t remember Python’s face.
I remembered that Python was no shorter than Libron.

Hey, long one!
- I?
- Yes, you!
- Well?
- Do you know Python?
- Python? We don't have that.
- Okay, what did you do on the night of the 22nd?
- On the 22nd? Yes. I slept at home.

Are you answering?
- I answer, stopudovo!
- Were you at home?
- Yes, I was at home!

The long one begins to press on Timon.
- What's wrong? What kind of charges are there for some Python?
I do not know such. We are for such “not in the subject”.
And suddenly, a Lada 9 drives into the yard.

The headlights crashed into the darkness,
To the sound of some acidic bullshit
Doors open and “deer” fall out -
And the “deer” have bent knees;

And they swam towards the crowd, hiding their pupils under the glass.
Tim looks, Libron’s forehead is wet, sweat is on his forehead.
It’s strange, because it’s not stuffy outside at all.
And one of the “deer” asks Libron:

Hello, Python! What's your mess here?


- Listen, bro!
- Python! What's the matter with you here?
- Hey, hello!
- Python! What's the matter with you here?
- Hey, bro!
- Listen, bro!

Python! What's the matter with you here?
- Listen, bro!
- Python! What's the matter with you here?
- Hey, hello!
- Python! What's the matter with you here?
- Hey, bro!
- Python! Everything is clear, we’ll talk about it later.

Yes, I didn't understand. What's the outcome with Python?

I'll tell you my little backstory.

Once again I got tired of tinkering with another controller, circuit and PCB, and, depressed by the market average salary of an ordinary electronics engineer, I decided - I want to become a programmer again.

I can’t say that I was already a programmer, but I received my education 3 years ago with a degree in Information Systems and Technologies at Military Mechanics. And fate brought me into electronics circuit design during my university days. Previously, frequent business trips to sites saved me (while I was young and single - interesting), but last year everything was completely boring.
While reading Habr, I chose Python.

These first and second recent articles helped determine how and what to start.

Actually, on the recommendation, I started in early September by studying: Mark Lutz. Learning Python, 4th Edition. Gritting my teeth and clenching everything that was squeezing into a fist, I used the remaining motivation to read to page 803, doing all the exercises along the way. In the middle of the OOP, I completely cringed. The book is good, but it's dreary - I have no strength.

I just didn’t want to give up, so I then tried Google’s python class course. Wow, how cool it was to solve the final problem! Two evenings flew by in an instant.

Then I realized that pushing through the book might not be the best option. And I remembered that I saw a post about courses at Western universities. Knowing spoken English used to stop me, but I understood Nick Parlante!

No sooner said than done, and now I’m already enrolled in two courses. We have already written about the first one, and about the second one. And the fact that one has Python 2.7 and the other 3.2 is even better, I thought. After meticulous Lutz, the first 2 weeks of both courses clicked like nuts. Special thanks to progress bar for the motivation. And by clicking on the links it was found - CS188.1x: Artificial Intelligence. What do they write?

PREREQUISITES
  • Programming
    1. Object-Oriented Programming
    2. Recursion
    3. Python or the ability to learn Python quickly (short referesher provided)
  • Data Structures
    1. Lists vs. Sets (Arrays, Hashtables)
    2. Queuing (Stacks, Queues, Priority Queues)
    3. Trees vs. Graphs (Traversal, Backpointers)
  • Math
    1. Probability, Random Variables, and Expectations (Discrete)
    2. Basic Asymptotic Complexity (Big-O)
    3. Basic Counting (Combinations and Permutations)

Cool! I’ll remember the math, train my still small python, and it’s okay that the course is already in its 2nd week.

Full course program

Introduction to AI

  • Overview
  • Agents: Perception, Decisions, and Actuation
Search and Planning
  • Uninformed Search (Depth-First, Breadth-First, Uniform-Cost)
  • Informed Search (A*, Greedy Search)
  • Heuristics and Optimality
Constraint Satisfaction Problems
  • Backtracking Search
  • Constraint Propagation (Forward Checking, Arc Consistency)
  • Exploiting Graph Structure
Game Trees and Decision Theory
  • Decision Theory
    Preferences, Rationality, and Utilities
    Maximum Expected Utility
  • Game Trees and Tree-Structured Computation
    Minimax, Expectimax, Combinations
    Evaluation Functions and Approximations
    Alpha-Beta Pruning
Markov Decision Processes (MDPs)
  • Policies, Rewards, and Values
  • Value Iteration
  • Policy Iteration
Reinforcement Learning (RL)
  • TD/Q Learning
  • Exploration
  • Approximation
Conclusion and Wrap-Up
No Lecture, Final Exam Week
First encounter with reality
I'll tell you more about the course. The introductory lecture made a very favorable impression. A pleasantly speaking (and most importantly, not bearded!) guy, well-designed slides (later I found out that a separate designer worked on the pictures). The lectures are recorded from a real audience, the students' reactions (mostly laughter) can be heard. They told us what they mean by AI today, what has changed since the 50s, showed videos from Google machines, as well as their robot, which neatly folds shirts and T-shirts. Hmm, at my university the transfer of knowledge about AI began and ended with a story about the Turing test.

The downside for me is the inability to download videos with subtitles locally.

Lectures are good, but practice? Yeah, in the first week we have (Optional) Math Self Diagnostic, (Optional) Python Refresher.
Here is an example of a question from the Math section:

You are playing a solitaire game in which you are dealt three cards without replacement from a simplified deck of 10 cards (marked 1 through 10). You win if one of your cards is a 10 or if all of your cards are odd.
How many winning hands are there if different orders are different hands?
What is your chance of winning?

Actually, higher technical education whispers: “This has already happened somewhere...” With the help of Wikipedia, mathematics came to mind. I looked into the python refresher, but the self-confidence that I had gained after Lutz and two courses gave way to laziness, and I did not do the problem, deciding to move on to week two.

Search and trees
I was introduced to the concept of graphs and search tree expansion at the university. So I expected it to be a bit boring. But the yellow old Pac-Man shown by the teacher kept my interest. Depth First, Breadth First, Uniform Cost, Greedy, A*(with heuristic) Search - all this was explained sequentially, and the example was Pac-Man, happily running through the maze for points in accordance with the search algorithm. And not a line of code in the lectures. I like it.

On the same day, homework was mastered with lectures - graphs and general questions about beetles in the maze
But the further tab project 1 plunged me into a stupor. Download the archive (more details, thanks to Nbooo), run pacman.py under python 2.7 and play (you can also run it with the -h switch for help). Now write your functions in the search.py ​​module, your pacman must find food in the corner of the maze. This is what it looks like.

How can this be, because we weren’t taught how to write it. But since I took it. Work has been put aside. On the first day, several crooked implementations of Depth First Search were written, the pacman regularly began to get to food. But they were mercilessly removed; it turned out that the number of branches uncovered by the search and the optimality of the path was strictly controlled. Your functions and methods are tested automatically after uploading the source code to the server. Having once again erased the page of code, he threw down his sword and took up the plowshare. The pieces of paper were covered with trees, drawings of Pac-Man and a maze. Fellow electronic engineers considered it their duty to grin as they passed by. As a result, an implementation was found. Anyone who wants to learn should suffer on their own. From those who are familiar with Python and algorithms, I will be glad to hear comments on the matter.

Code

I think everything is clear here, util.Stack() and utilQueue() are actually lists wrapped in classes for the convenience of students, with push and pop methods, FIFO and LIFO, respectively:

Def depthFirstSearch(problem): """ Search the deepest nodes in the search tree first Your search algorithm needs to return a list of actions that reaches the goal. Make sure to implement a graph search algorithm To get started, you might want to try some of these simple commands to understand the search problem that is being passed in: print "Start:", problem.getStartState() >>> Start: (4, 3) print "Is the start a goal?", problem.isGoalState (problem.getStartState()) >>> Is the start a goal? False print "Start"s successors:", problem.getSuccessors(problem.getStartState()) >>> Start"s successors: [((4, 4 ), "North", 1), ((4, 2), "South", 1), ((5, 3), "East", 1), ((3, 3), "West", 1) ] """ def fromXYtoXY(coord1, coord2): """ tuple(int,int), tuple(int,int) -> str Takes near coord1 coord2 tuples, returns string way, or error sample for tinyMaze: >>> fromXYtoXY((5,5),(4,5)) >>>"West" >>>fromXYtoXY((1,3),(2,3)) >>>"East" """ if coord1== coord2: if coord1-coord2==1: return "South" else: return "North" elif coord1==coord2: if coord1-coord2==1: return "West" else: return "East" else: return ("Path not found from %s to %s" % (coord1, coord2)) Fringe = util.Stack() currState=problem.getStartState() Fringe.push() while True: currState=Fringe.pop() if problem.isGoalState( currState[-1]): listWays= fromState=currState # form an output list with paths for state in currState: # ex: ["South", "West"] listWays.append(fromXYtoXY(fromState,state)) fromState=state return listWays break for State, Way, Price in problem.getSuccessors(currState[-1]): if not State in currState: nextPath=currState[:] nextPath.append(State) Fringe.push(nextPath)

The implementation of Breadth First Search, in my opinion, came out a little more beautiful.

Code

def breadthFirstSearch(problem): """ Search the shallowest nodes in the search tree first. """ fringe=util.Queue() visitedNodes= fringe.push() # save starting coordinates + null path while not fringe.isEmpty() : #while there is something in the queue currNode = fringe.pop() #take the last one if currNode not in visitedNodes: #if visitedNodes.append(currNode) #add for State, Way, Price in problem.getSuccessors(currNode): path=currNode[:] #let's make a path for the child branch path.append(Way) if problem.isGoalState(State): return path else: fringe.push()

Then Uniform Cost Search and A* Search were relatively easily implemented (with Euclidean distance to food as a heuristic function)

Code

def uniformCostSearch(problem): "Search the node of least total cost first." fringe=util.PriorityQueue() visitedNodes= fringe.push(,0) while not fringe.isEmpty(): currNode = fringe.pop() if problem .isGoalState(currNode): return currNode if currNode not in visitedNodes: #if not visited visitedNodes.append(currNode) #add for State, Way, Price in problem.getSuccessors(currNode): path=currNode[:] #make a path to child branch totalCost=currNode+Price path.append(Way) fringe.push(,totalCost) def aStarSearch(problem, heuristic=nullHeuristic): "Search the node that has the lowest combined cost and heuristic first." "*** YOUR CODE HERE ***" fringe=util.PriorityQueue() visitedNodes= fringe.push(,0) while not fringe.isEmpty(): currNode = fringe.pop() if problem.isGoalState(currNode): print "Success!!", currNode return currNode if currNode not in visitedNodes: #if not visited visitedNodes.append(currNode) #add for State, Way, Price in problem.getSuccessors(currNode): #print "succ", State , Way, Price path=currNode[:] #make the path to the child branch totalCost=currNode+Price path.append(Way) fringe.push(,totalCost+heuristic(State,problem))

The second part of Project 1 asked students to modify search problems in the searchAgents.py module by adapting methods from child classes. If earlier there was one Pac-Man and one food, now there is one Pac-Man and food in 4 corners, through which you need to walk along the optimal path. And also come up with a heuristic function for A* Search, which is designed to reduce the cost of expanding search tree branches (the scoring system is as follows: inconsistent heuristics will get no credit. 1 point for any non-trivial consistent heuristic. 1 point for expanding fewer than 1600 nodes . 1 point for expanding than 1200 nodes.).

Project 1 ended with solving the problem of optimally eating many points in a maze.

As a result, I spent almost 3 working days solving these problems; fortunately there was some lull at work. It was interesting to rack my brains and, I hope, useful in the future.

I want to end with the humorous words of the teacher in one of the lectures:

Anything you want to do, NP-hard. Sorry, this is an AI class. Everything is hard.
I hope this review helped someone a little. I recommend the course (or just solving problems) to all beginners to get acquainted with python, and I’m looking forward to project 2.

Tags: Add tags


A boy's yard story from Gazgolder and Noggano.
!

Kim and the boy walked home through dark courtyards.
Turley about the seas and Miami;
Turley about the nine and the new Java.
It was summer with mosquitoes outside.

They spoke and then remained silent.
Then they talked again about what they had talked about at the beginning.
About the fact that it would be nice to set sail from here.
- Is it sad or funny?
- This? It is sad.

Suddenly, a company emerged from around the corner,
A face the boys had not seen before.

Is there anything to smoke?
- Do you have a call?
- Where will you be from?
- What, you don’t smoke anymore?
- Don't be rude to me!
- Long, don’t twitch!
- What are these greyhounds?
- Who is signing for you?

While the tertz was going on, the little one rushed at full speed.
About six people ran after him.
Timofey remained standing with the others.
- We will take everything you have for this.

The cormorants sprinkled with thieves' words.
But Timofey stood and thought, is it you?
A chase appeared from behind the garages.
They didn’t catch up with the little one, or they left the little one there.
And suddenly the Opel crashed into concrete.
- What are you waiting for, long fuck, Python!

Tim understood immediately who was the long one and who was the Python.
A blow to the face with a fist, everything turned white with milk.
Calling yourself Python, well, you have to be an asshole.
Tim was trampled, someone pulled the phone.

Someone pulled the wallet, documents and money.
They tore off the Armani slippers.
They blew it fiercely, like snowstorms blow spruce trees in the North.
The fuck? 15 bodies trampling on one body.

When Tim came to his senses, it was already dawn.
There was a guy sitting nearby, and some guys from the area.
What's the point of saying this when your face is like a soccer ball?
We took Tim home, no time for pumping today!
www.site
Tima eats soup through a straw and pisses on blood.
He goes for walks with a cane.
He keeps a keen eye on the area from his balcony.
- Where to find Python.

They are mulling over the plan of the house, like in the General Staff.
They kick about retribution and its scale!
Sanya the karateka and his brother pulled up.
These brothers are enough to take them out!

A crowd of about 40 people had gathered.
80 tough sneakers.
In one of the courtyards there were children sitting,
And Timokha immediately moved to ram.

He looks through the cracks in his swollen face as if through a sight.
Timyn's patsiks keep this bunch in a ring.
- Hello, Python! Timofey blurted out loudly,
But no one responded to this strange nickname.

It was dark then, and Tim didn’t remember Python’s face.
I remembered that Python was no shorter than Libron.

Hey, long one!
- I?
- Yes, you!
- Well?
- Do you know Python?
- Python? We don't have that.
- Okay, what did you do on the night of the 22nd?
- On the 22nd? Yes. I slept at home.

Are you answering?
- I answer, stopudovo!
- Were you at home?
- Yes, I was at home!

The long one begins to press on Timon.
- What's wrong? What kind of charges are there for some Python?
I do not know such. We are for such “out of topic”.
And suddenly, a Lada 9 drives into the yard.

The headlights crashed into the darkness,
To the sound of some acidic bullshit
Doors open and “deer” fall out -
And the “deer” have bent knees;

And they swam towards the crowd, hiding their pupils under the glass.
Tim looks, Libron's forehead is very wet.
It’s strange, because it’s not stuffy outside at all.
And one of the “deer” asks Libron:

Hello, Python! What's your mess here?


- Listen, brother!

- Hey, hello!
- Python! What's the matter with you here?
- Hey, bro!

- Listen, bro!

Python! What's your mess here?
- Listen, brother!
- Python! What's the matter with you here?
- Hey, hello!
- Python! What's the matter with you here?
- Hey, bro!
- Python! Everything is clear, we’ll talk about it later.

Yes, I didn't understand. What's the outcome with Python?

Work and education