def sort_pair(a, b):
def sort_pair(pair):
a, b = pair
if a <= b:
return (a, b)
else:
return (b, a)
print(sort_pair((5, 1))) # (1, 5)
print(sort_pair((2, 2))) # (2, 2)
print(sort_pair((7, 8))) # (7, 8)
from typing import Tuple
def sort_pair(pair: Tuple[int, int]) -> Tuple[int, int]:
a, b = pair
if a <= b:
return (a, b)
else:
return (b, a)
print(sort_pair((5, 1))) # (1, 5)
print(sort_pair((2, 2))) # (2, 2)
print(sort_pair((7, 8))) # (7, 8)
<button class="dangerous" disabled>Сохранить</button>
document.addEventListener(‘load’, function() {
const dangers = document.querySelectorAll(".dangerous");
dangers.forEach((item) => {
item.removeAttribute('disabled'):
});
}
*.css linguist-detectable=false
struct Api {
key: String
}
struct ApiPart<'a>{
api: &'a Api
}
impl Api {
pub fn part<'a>(&'a self) -> ApiPart<'a> {
ApiPart {api: self}
}
}
fn new(api_key: *const String) -> Self {
let api_key = unsafe { &*api_key };
return Self {
api_key,
};
}
fn new(api_key: impl Into<String>) -> Self {
let api_key = api_key.into();
return Self {
api_key,
};
}
#include <IServiceFactory.h>
class Sample {
private:
IServiceFactory _factory;
public:
Sample(IServiceFactory factory): _factory(factory) { }
DoSomething() {
auto service = _factory.CreateService();
service.MakeStuff();
}
}
int main() {
auto factory = ServiceFactoryImpl(); // Читаем конфигурацию, параметры ОС и др.
auto sample = Sample(factory);
sample.DoSomething();
}