This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Дана последовательность, в которой находятся рандомные числа в произвольном порядке, | |
но в ней находятся только парные элементы. | |
Пример: 2 1 5 5 2 1 | |
К ним добавляют элемент в произольное место | |
Допустим 2 3 1 5 5 2 1 | |
Найти этот уникальный элемент используя только один цикл | |
========================================= | |
(сложность программ - линейная) | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from matplotlib import mlab | |
import matplotlib.pyplot as plt | |
def f(x): | |
return 6*x**5-5*x**4-4*x**3+3*x**2 | |
def df(x): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC8AAAABCAIAAADB42C9AAAAVElEQVR42jWMOwqAMBAF5yjpbMQrWNnaWwoKpknAD+LtXQYCWwzDvAVmqHBDgksOOGCFEzboNa8mggJd67Mwyovbx1UyLvYx3JvMmuSqelN7+8HwA2+IEHzgr4OjAAAAAElFTkSuQmCC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
import urllib.request as url | |
def parse(): | |
page = url.urlopen('http://python.org').read() | |
soup = BeautifulSoup(page, 'html.parser') | |
soup.prettify() | |
main_div = soup.find('div', class_="medium-widget event-widget last",) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
def is_even(number): | |
return True | |
class TestCase(unittest.TestCase): | |
def setUp(self): | |
self.expected_output = [ | |
(2, True), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.db.models import Q | |
from django.http import HttpResponse | |
from django.shortcuts import render_to_response | |
from django.template import RequestContext | |
from django.template.loader import render_to_string | |
import json | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Database | |
{ | |
private $db_host = 'localhost'; | |
private $db_user = ''; | |
private $db_pass = ''; | |
private $db_name = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Article | |
{ | |
private $posCode; | |
private $article; | |
private $xml; | |
public function __construct($posCode, $article) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CardScheme | |
{ | |
const CARD_TYPE_MASTERCARD = 'MASTERCARD'; | |
const CARD_TYPE_MAESTRO = 'MAESTRO'; | |
const CARD_TYPE_MIR = 'MIR'; | |
const CARD_TYPE_VISA = 'VISA'; | |
protected $panNumber; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class CalendarDetail extends iCalendar | |
{ | |
protected function getArray($in) | |
{ | |
if (is_array($in)) { | |
return $in; | |
} |
OlderNewer