if __name__ == '__main__':
count, start = input('input count and start: ').split()
count, start = int(count), float(start)
last_piece = (start + (count - 1) * 360 / count) % 360
print(f"{last_piece:.1f}")
pip install pyttsx3==2.71
import time
import sys
from functools import lru_cache
@lru_cache(5000000)
def calc(number: int) -> int:
if number == 1:
return 0
elif number % 2 == 0:
iterations = calc(number//2)+1
else:
iterations = calc(3*number+1)+1
return iterations
if __name__ == '__main__':
sys.setrecursionlimit(2000)
start = time.process_time()
max_num, num = 0, 0
for i in range(1, 1000000+1):
if (cur_num := calc(i)) > max_num:
max_num, num = cur_num, i
print('n =', num, 'iterations =', max_num+1, 'time =', time.process_time()-start, 'sec')
@numba.njit()
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
ZetCode PyQt5 tutorial
In this example, we draw text in Russian Cylliric.
Author: Jan Bodnar
Website: zetcode.com
Last edited: August 2017
"""
import sys
from PyQt5.QtWidgets import QWidget, QApplication
from PyQt5.QtGui import QPainter, QColor, QFont
from PyQt5.QtCore import Qt
class Example(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.text = "Лев Николаевич Толстой\nАнна Каренина"
self.setGeometry(300, 300, 280, 170)
self.setWindowTitle('Drawing text')
self.show()
def paintEvent(self, event):
qp = QPainter()
qp.begin(self)
self.drawText(event, qp)
qp.end()
def drawText(self, event, qp):
qp.setPen(QColor(168, 34, 3))
qp.setFont(QFont('Decorative', 10))
qp.drawText(event.rect(), Qt.AlignCenter, self.text)
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
from __future__ import annotations
from typing import TypeVar
_TA = TypeVar('_TA', bound='A')
class A:
type_ = None
def method(self: _TA) -> _TA.type_:
return self.type_
class B(A):
type_ = int
class C(A):
type_ = str
if __name__ == '__main__':
print(B().method())
print(C().method())
if __name__ == '__main__':
with open('acda010.ditamap', encoding='utf-8-sig') as file:
cc = ''.join(file.readlines())
with open('a.txt', 'w', encoding='cp1251') as file:
print(cc, end='', file=file)
pip install -U numpy
pip install -U scipy
pip install -U matplotlib
pip install -U pyside
pip install -U PyQt5