This file contains hidden or 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
| Оператор | Описание | |
|---|---|---|
| == | Если значения двух операндов равны, то условие истинно. | |
| != | Если значения двух операндов не равны, то условие истинно. | |
| <> | Если значения двух операндов не равны, то условие истинно. | |
| > | Если значение левого операнда больше значения правого операнда, то условие истинно. | |
| < | Если значение левого операнда меньше значения правого операнда, то условие истинно. | |
| >= | Если значение левого операнда больше или равно значению правого операнда, то условие истинно. | |
| <= | Если значение левого операнда меньше или равно значению правого операнда, то условие истинно. |
This file contains hidden or 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
| def plural_days(n): | |
| days = ['день', 'дня', 'дней'] | |
| if n % 10 == 1 and n % 100 != 11: | |
| p = 0 | |
| elif 2 <= n % 10 <= 4 and (n % 100 < 10 or n % 100 >= 20): | |
| p = 1 | |
| else: | |
| p = 2 |
This file contains hidden or 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 ctypes | |
| import pathlib | |
| if __name__ == "__main__": | |
| # загрузка библиотеки | |
| libname = pathlib.Path().absolute() / "libcadd.so" | |
| c_lib = ctypes.CDLL(libname) | |
| x, y = 6, 2.3 |
This file contains hidden or 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
| https://web.archive.org/web/20211114112811/https://gist.github.com/imgVOID/35e1c463ce187fac9f793e06a6688649 |
This file contains hidden or 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 React, {useState, useEffect} from 'react'; | |
| function Example() { | |
| const [count, setCount] = useState(0); | |
| useEffect(() => { | |
| document.title = `Нажато ${count} раз`; | |
| }); | |
| } |
This file contains hidden or 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 React, { useState } from 'react'; | |
| function Counter() { | |
| // Определение переменной-счётчика | |
| const [count, setCount] = useState(0); | |
| return ( | |
| <div> | |
| <p>Вы нажали {count} раз</p> | |
| <button onClick={() => setCount(count + 1)}> | |
| Нажми меня |
This file contains hidden or 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
| class Welcome extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = {}; | |
| } | |
| render() { | |
| return ( | |
| <div> | |
| <h1>Hello, world!</h1> |
This file contains hidden or 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
| class Time extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = {date: date: new Date()}; | |
| } | |
| render() { | |
| return ( | |
| <div> | |
| <h1>It is {this.state.date.toLocaleTimeString()}</h1> |
This file contains hidden or 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
| class Post extends Component { | |
| constructor(props){ | |
| super(props); | |
| this.state = {} | |
| } | |
| render(){ | |
| // код пользовательского интерфейса | |
| } | |
| } |
This file contains hidden or 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 { useParams, useLocation } from "react-router-dom"; | |
| import React from 'react'; | |
| const Profile = () => { | |
| // Используйте хук useParams для получения имени пользователя из URL. | |
| // Имя пользователя должно быть применено в качестве именованного параметра в маршруте. | |
| let { username } = useParams(); | |
| // useLocation применяется для захвата состояния из входных данных в объект. | |
| // Так можно захватить каждое поле в объекте, используя то же имя, что и имя переменной. |
NewerOlder