background preloader

Python

Facebook Twitter

Python Cheat Sheet. String String Methods Array Indexes and Slices.

Python Cheat Sheet

Object-oriented Programming (OOP) in C++ 1.

Object-oriented Programming (OOP) in C++

Why OOP? Suppose that you want to assemble your own PC, you go to a hardware store and pick up a motherboard, a processor, some RAMs, a hard disk, a casing, a power supply, and put them together. You turn on the power, and the PC runs. You need not worry whether the motherboard is a 4-layer or 6-layer board, whether the hard disk has 4 or 6 plates; 3 inches or 5 inches in diameter, whether the RAM is made in Japan or Korea, and so on.

You simply put the hardware components together and expect the machine to run. Similarly, a car is assembled from parts and components, such as chassis, doors, engine, wheels, brake, and transmission. Hardware, such as computers and cars, are assembled from parts, which are reusable components. How about software? Why re-invent the wheels? Object-oriented Programming (OOP) in C++ Сложност на алгоритми. Сравнение на различни решения.

Сложност на алгоритми

Как да апроксимираме бързината на алгоритми? Какво е сложност? Big-O нотация. Big-O Algorithm Complexity Cheat Sheet. Linked list. A linked list whose nodes contain two fields: an integer value and a link to the next node.

Linked list

The last node is linked to a terminator used to signify the end of the list. The principal benefit of a linked list over a conventional array is that the list elements can easily be inserted or removed without reallocation or reorganization of the entire structure because the data items need not be stored contiguously in memory or on disk, while an array has to be declared in the source code, before compiling and running the program. Linked lists allow insertion and removal of nodes at any point in the list, and can do so with a constant number of operations if the link previous to the link being added or removed is maintained during list traversal. On the other hand, simple linked lists by themselves do not allow random access to the data, or any form of efficient indexing. Advantages[edit] Disadvantages[edit] History[edit] Basic concepts and nomenclature[edit] Singly linked list[edit] Tradeoffs[edit]

Introduction to Object Oriented Programming Concepts (OOP) and More. Recommended framework: Table of contents 1.

Introduction to Object Oriented Programming Concepts (OOP) and More

Lesson: Object-Oriented Programming Concepts (The Java™ Tutorials > Learning the Java Language) If you've never used an object-oriented programming language before, you'll need to learn a few basic concepts before you can begin writing any code.

Lesson: Object-Oriented Programming Concepts (The Java™ Tutorials > Learning the Java Language)

This lesson will introduce you to objects, classes, inheritance, interfaces, and packages. Each discussion focuses on how these concepts relate to the real world, while simultaneously providing an introduction to the syntax of the Java programming language. What Is an Object? An object is a software bundle of related state and behavior. Software objects are often used to model the real-world objects that you find in everyday life. Списък (абстрактен тип данни) Introduction to Programming with C# / Java Books » Глава 16. Линейни структури от данни. В тази тема...

Introduction to Programming with C# / Java Books » Глава 16. Линейни структури от данни

Много често, за решаване на дадена задача се нуждаем да работим с последователности от елементи. Например, за да прочетем тази книга, трябва да прочетем последователно всяка една страница т.е. да обходим последова­телно всеки един от елементите на множеството от нейните страници. Introduction to Programming with C# / Java Books » Глава 11. Създаване и използване на обекти. В тази тема...

Introduction to Programming with C# / Java Books » Глава 11. Създаване и използване на обекти

В настоящата тема ще се запознаем накратко с основните понятия в обектно-ориентираното програмиране – класовете и обектите – и ще обясним как да използваме класовете от стандартните библиотеки на .NET Framework. Алгоритми и структури от данни. Този сайт е предназначен за студентите от специалност Информатика в Пловдивския университет „Паисий Хилендарски“.

Алгоритми и структури от данни

В него са поместени упражненията по дисциплината Алгоритми и структури от данни. Те се състоят от съвсем кратка теоретична част и подробно обяснен код на C++. Classes (I) Classes are an expanded concept of data structures: like data structures, they can contain data members, but they can also contain functions as members.

Classes (I)

An object is an instantiation of a class. In terms of variables, a class would be the type, and an object would be the variable. Classes are defined using either keyword class or keyword struct, with the following syntax: Where class_name is a valid identifier for the class, object_names is an optional list of names for objects of this class. Classes have the same format as plain data structures, except that they can also include functions and have these new things called access specifiers. C, PHP, VB, .NET » Списъци, динамични масиви, стекове и опашки. 1. Масиви: Когато се заговори за понятието „списък“ всеки начинаещ програмист моментално се досеща за най-често използваната в учебните примери структура – масив. Списък (абстрактен тип данни) Python Tutorial: Object Oriented Programming. Object Oriented Programming In the previous chapters, we intentionally avoided object oriented programming (OOP).

We think it's easier and more fun to start learning Python without having to know about object oriented programming. But even though we have avoided OOP, we have used in our examples objects and methods from classes. In this chapter we are giving a proper introduction into the object oriented approach of Python. OOP is one of the most powerful tools of Python, but nevertheless you don't have to use it, i.e. you can write powerful and efficient programs without it as well.

9. Classes. Compared with other programming languages, Python’s class mechanism adds classes with a minimum of new syntax and semantics. It is a mixture of the class mechanisms found in C++ and Modula-3. Python classes provide all the standard features of Object Oriented Programming: the class inheritance mechanism allows multiple base classes, a derived class can override any methods of its base class or classes, and a method can call the method of a base class with the same name. Objects can contain arbitrary amounts and kinds of data. As is true for modules, classes partake of the dynamic nature of Python: they are created at runtime, and can be modified further after creation. In C++ terminology, normally class members (including the data members) are public (except see below Private Variables and Class-local References), and all member functions are virtual. (Lacking universally accepted terminology to talk about classes, I will make occasional use of Smalltalk and C++ terms.

A Beginner's Python Tutorial/Classes. Introduction[edit] One thing that you will get to know about programming, is that programmers like to be lazy. If something has been done before, why should you do it again? That is what functions cover in Python. You've already had your code do something special.

Python Object Oriented. Python has been an object-oriented language since it existed. Because of this, creating and using classes and objects are downright easy. A Gentle Introduction to Programming Using Python. A Gentle Introduction to Programming Using Python. Non-Programmer's Tutorial for Python 3/Print version. All example Python source code in this tutorial is granted to the public domain.

Therefore you may modify it and relicense it under any license you please. Since you are expected to learn programming, the Creative Commons Attribution-ShareAlike license would require you to keep all programs that are derived from the source code in this tutorial under that license. Since the Python source code is granted to the public domain, that requirement is waived. This tutorial is more or less a conversion of Non-Programmer's Tutorial for Python 2.6. Older versions and some versions in Korean, Spanish, Italian and Greek are available from. Python Tutorial. The Python tutorial is constructed to teach you the fundamentals of the Python programming language. Eventually, the Python Tutorial will explain how to construct web applications, but currently, you will learn the basics of Python offline. Python can work on the Server Side (on the server hosting the website) or on your computer.

PythonMonk - Interactive Python tutorials. Invent Your Own Computer Games with Python. How to Learn to Learn Python. A reader on my post about why everyone should program asked me for some advice on the step I took to learn the Python programming language. So I thought I might write a little guide for those who think they might be interested in learning Python. This guide will be a little unusual by most standards – and it won’t be for everyone. It will be for those who are vaguely interested in learning to program, but aren’t entirely sure if it’s for them. It’s for those who have perhaps tried before to get into it, but couldn’t sustain the discipline or motivation to keep going. Those who often hear stories about people getting addicted to programming but never could understand why themselves – such people might get something out of this guide. LearnPYdia / FrontPage. S Python Class - Google's Python Class - Google Code.

Welcome to Google's Python Class -- this is a free class for people with a little bit of programming experience who want to learn Python. The class includes written materials, lecture videos, and lots of code exercises to practice Python coding. These materials are used within Google to introduce Python to people who have just a little programming experience. The first exercises work on basic Python concepts like strings and lists, building up to the later exercises which are full programs dealing with text files, processes, and http connections. The class is geared for people who have a little bit of programming experience in some language, enough to know what a "variable" or "if statement" is. Beyond that, you do not need to be an expert programmer to use this material. This material was created by Nick Parlante working in the engEDU group at Google. Tip: Check out the Python Google Code University Forum to ask and answer questions. Tutorial - Learn Python in 10 minutes.

NOTE: If you would like some Python development done, my company, Stochastic Technologies, is available for consulting. This tutorial is available as a short ebook. The e-book features extra content from follow-up posts on various Python best practices, all in a convenient, self-contained format. All future updates are free for people who purchase it. Preliminary fluff. BeginnersGuide.

Learn Python - Free Interactive Python Tutorial.