SPython в 3.11
This commit is contained in:
parent
1dc78980b2
commit
6d15540895
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
||||||
public const string Major = "3";
|
public const string Major = "3";
|
||||||
public const string Minor = "11";
|
public const string Minor = "11";
|
||||||
public const string Build = "0";
|
public const string Build = "0";
|
||||||
public const string Revision = "3654";
|
public const string Revision = "3661";
|
||||||
|
|
||||||
public const string MainVersion = Major + "." + Minor;
|
public const string MainVersion = Major + "." + Minor;
|
||||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
%COREVERSION%=0
|
|
||||||
%REVISION%=3654
|
|
||||||
%MINOR%=11
|
%MINOR%=11
|
||||||
|
%REVISION%=3661
|
||||||
|
%COREVERSION%=0
|
||||||
%MAJOR%=3
|
%MAJOR%=3
|
||||||
|
|
|
||||||
10
InstallerSamples/SPython/GraphWPF_use_example.pys
Normal file
10
InstallerSamples/SPython/GraphWPF_use_example.pys
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
from GraphWPF import *
|
||||||
|
|
||||||
|
color = RandomColor()
|
||||||
|
|
||||||
|
def MouseMove(x: float, y: float, mb: int):
|
||||||
|
if mb == 1:
|
||||||
|
FillCircle(x, y, 10, color)
|
||||||
|
|
||||||
|
|
||||||
|
OnMouseMove = MouseMove
|
||||||
15
InstallerSamples/SPython/argmin.pys
Normal file
15
InstallerSamples/SPython/argmin.pys
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
# индекс минимального элемента
|
||||||
|
def argmin(arr: list[int]) -> int:
|
||||||
|
if len(arr) == 0:
|
||||||
|
return -1
|
||||||
|
res = 0
|
||||||
|
for i in range(1, len(arr)):
|
||||||
|
if arr[i] < arr[res]:
|
||||||
|
res = i
|
||||||
|
return res
|
||||||
|
|
||||||
|
print(argmin([1, 2, 3]))
|
||||||
|
print(argmin([3, 2, 1]))
|
||||||
|
# a = [4,9,16,8,2,15,13,13,15,2,8,16,9,4]
|
||||||
|
a = [i ** 2 % 17 for i in range(2, 16)]
|
||||||
|
print(argmin([i ** 2 % 17 for i in range(2, 16)]))
|
||||||
27
InstallerSamples/SPython/compound_conditions_example.pys
Normal file
27
InstallerSamples/SPython/compound_conditions_example.pys
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
N = 7
|
||||||
|
|
||||||
|
# Выводит первые N чисел,
|
||||||
|
# которые можно тремя различными
|
||||||
|
# способами представить как
|
||||||
|
# сумму двух квадратов целых чисел
|
||||||
|
def print_sequence(N: int):
|
||||||
|
a = 0
|
||||||
|
while True:
|
||||||
|
a += 1
|
||||||
|
for b in range(1, a):
|
||||||
|
for c in range(1, b):
|
||||||
|
for d in range(1, c + 1):
|
||||||
|
for e in range(1, d):
|
||||||
|
for f in range(1, e):
|
||||||
|
if a ** 2 + f ** 2 == b ** 2 + e ** 2 == c ** 2 + d ** 2:
|
||||||
|
print(a ** 2 + f ** 2, '\t= ',
|
||||||
|
a, '^2 + ', f, '^2 \t= ',
|
||||||
|
b, '^2 + ', e, '^2 \t= ',
|
||||||
|
c, '^2 + ', d, '^2', sep='')
|
||||||
|
|
||||||
|
N -= 1
|
||||||
|
if N == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
print_sequence(N)
|
||||||
42
InstallerSamples/SPython/delete_by_mouse.pys
Normal file
42
InstallerSamples/SPython/delete_by_mouse.pys
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
from WPFObjects import RectangleWPF, ObjectUnderPoint
|
||||||
|
from WPFObjects import Colors, Window, OnMouseDown
|
||||||
|
from PABCSystem import Random, Inc, Milliseconds
|
||||||
|
|
||||||
|
CountSquares = 10
|
||||||
|
StatusRect: RectangleWPF
|
||||||
|
CurrentDigit = 1
|
||||||
|
Mistakes = 0
|
||||||
|
|
||||||
|
def DrawStatusText():
|
||||||
|
if CurrentDigit <= CountSquares:
|
||||||
|
StatusRect.Text = ('Удалено квадратов: ' + str(CurrentDigit-1)
|
||||||
|
+ '\tОшибок: ' + str(Mistakes))
|
||||||
|
else:
|
||||||
|
StatusRect.Text = ('Игра окончена. Время: ' + str(Milliseconds() // 1000)
|
||||||
|
+ ' с.\tОшибок: ' + str(Mistakes))
|
||||||
|
|
||||||
|
|
||||||
|
def MyMouseDown(x: float, y: float, mb: int):
|
||||||
|
ob = ObjectUnderPoint(x, y)
|
||||||
|
if ob is RectangleWPF and ob != StatusRect:
|
||||||
|
if ob.Number == CurrentDigit:
|
||||||
|
ob.Destroy()
|
||||||
|
Inc(CurrentDigit)
|
||||||
|
DrawStatusText()
|
||||||
|
else:
|
||||||
|
ob.Color = Colors.Red
|
||||||
|
Inc(Mistakes)
|
||||||
|
DrawStatusText()
|
||||||
|
|
||||||
|
|
||||||
|
Window.Title = 'Игра: удали все квадраты по порядку'
|
||||||
|
for i in range(1, CountSquares + 1):
|
||||||
|
x = Random(Window.Width - 50)
|
||||||
|
y = Random(Window.Height - 100)
|
||||||
|
ob = new RectangleWPF(x, y, 50, 50, Colors.LightGreen, 1)
|
||||||
|
ob.FontSize = 25
|
||||||
|
ob.Number = i
|
||||||
|
StatusRect = new RectangleWPF(0, Window.Height - 40,
|
||||||
|
Window.Width, 40, Colors.LightBlue)
|
||||||
|
DrawStatusText()
|
||||||
|
OnMouseDown = MyMouseDown
|
||||||
26
InstallerSamples/SPython/game_example.pys
Normal file
26
InstallerSamples/SPython/game_example.pys
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
import random as rnd
|
||||||
|
|
||||||
|
hidden_number = rnd.randint(1, 100)
|
||||||
|
print('Угадай число от 1 до 100')
|
||||||
|
attempts = 0
|
||||||
|
left_border = 1
|
||||||
|
right_border = 100
|
||||||
|
while True:
|
||||||
|
attempts += 1
|
||||||
|
guess = int(input('Попытка ' + str(attempts) + ':'))
|
||||||
|
if guess < left_border or right_border < guess:
|
||||||
|
print('Число', guess, 'не из диапазона',
|
||||||
|
'[' + str(left_border) + ',', str(right_border) + ']')
|
||||||
|
continue
|
||||||
|
if guess < hidden_number:
|
||||||
|
left_border = guess + 1
|
||||||
|
print('Загаданное число больше', guess);
|
||||||
|
elif guess > hidden_number:
|
||||||
|
right_border = guess - 1
|
||||||
|
print('Загаданное число меньше', guess);
|
||||||
|
else:
|
||||||
|
print('Победа!!!')
|
||||||
|
break
|
||||||
|
print('Попробуй число от', left_border,
|
||||||
|
'до', right_border)
|
||||||
|
print('Тебе понадобилось', attempts, 'попыток')
|
||||||
24
InstallerSamples/SPython/in_out_example.pys
Normal file
24
InstallerSamples/SPython/in_out_example.pys
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
a = int(input('Введите первое число:'))
|
||||||
|
b = int(input('Введите второе число:'))
|
||||||
|
|
||||||
|
def print_expressions(a: int, b: int):
|
||||||
|
print(a, ' +', b, '=', a + b, end = '\n')
|
||||||
|
print(a, ' -', b, '=', a - b, end = '\n')
|
||||||
|
print(a, ' *', b, '=', a * b, end = '\n')
|
||||||
|
print(a, ' %', b, '=', a % b, end = '\n')
|
||||||
|
print(a, ' /', b, '=', a / b, end = '\n')
|
||||||
|
print(a, '//', b, '=', a // b, end = '\n')
|
||||||
|
print(a, '**', b, '=', a ** b, end = '\n')
|
||||||
|
|
||||||
|
print_expressions(a, b)
|
||||||
|
|
||||||
|
|
||||||
|
# Введите первое число: 10
|
||||||
|
# Введите второе число: 6
|
||||||
|
# 10 + 6 = 16
|
||||||
|
# 10 - 6 = 4
|
||||||
|
# 10 * 6 = 60
|
||||||
|
# 10 % 6 = 4
|
||||||
|
# 10 / 6 = 1.66666666666667
|
||||||
|
# 10 // 6 = 1
|
||||||
|
# 10 ** 6 = 1000000
|
||||||
9
InstallerSamples/SPython/list_methods.pys
Normal file
9
InstallerSamples/SPython/list_methods.pys
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
a = [1, 2, 3]
|
||||||
|
a.append(4)
|
||||||
|
a.insert(4, 2)
|
||||||
|
b = a.copy()
|
||||||
|
b.reverse()
|
||||||
|
print(b)
|
||||||
|
print(a)
|
||||||
|
print(a.count(2))
|
||||||
|
print(a.pop(1))
|
||||||
13
InstallerSamples/SPython/list_use_example.pys
Normal file
13
InstallerSamples/SPython/list_use_example.pys
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
def print_matr(matr: list[list[int]]):
|
||||||
|
for row in matr:
|
||||||
|
for elem in row:
|
||||||
|
print(elem, '\t', end=' ')
|
||||||
|
print()
|
||||||
|
|
||||||
|
|
||||||
|
matrix_of_integers: list[list[int]]
|
||||||
|
matrix_of_integers = [
|
||||||
|
[j * i for j in range(1, 10)]
|
||||||
|
for i in range(1, 10) if i % 2 == 0
|
||||||
|
]
|
||||||
|
print_matr(matrix_of_integers)
|
||||||
3
InstallerSamples/SPython/py1.pys
Normal file
3
InstallerSamples/SPython/py1.pys
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
n = int(input("Введите двузначние число:"))
|
||||||
|
|
||||||
|
print(n // 10, n % 10)
|
||||||
8
InstallerSamples/SPython/py10.pys
Normal file
8
InstallerSamples/SPython/py10.pys
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
from PABCSystem import Sin,KV,Dict
|
||||||
|
|
||||||
|
graph = { 'A': {'C': 3, 'D': 1}}
|
||||||
|
|
||||||
|
graph1 = Dict(KV(1,2))
|
||||||
|
|
||||||
|
print(Sin(3.1415/2),graph1,graph1)
|
||||||
|
|
||||||
3
InstallerSamples/SPython/py11.pys
Normal file
3
InstallerSamples/SPython/py11.pys
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
fruits = ['apple', 'banana', 'cherry']
|
||||||
|
for i, fruit in enumerate(fruits, 1): # начнём с 1
|
||||||
|
print(i, fruit)
|
||||||
20
InstallerSamples/SPython/py12.pys
Normal file
20
InstallerSamples/SPython/py12.pys
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
a = 1
|
||||||
|
|
||||||
|
def fun():
|
||||||
|
global a
|
||||||
|
# изменение глобальной a
|
||||||
|
a = 2
|
||||||
|
|
||||||
|
def fun2():
|
||||||
|
# создание локальной a
|
||||||
|
a = 3
|
||||||
|
|
||||||
|
print(a)
|
||||||
|
fun()
|
||||||
|
print(a)
|
||||||
|
fun2()
|
||||||
|
# a не меняется
|
||||||
|
print(a)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
13
InstallerSamples/SPython/py13.pys
Normal file
13
InstallerSamples/SPython/py13.pys
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
lst = [3,6,2,5,1,4]
|
||||||
|
|
||||||
|
def even(x: int) -> bool:
|
||||||
|
return x % 2 == 0
|
||||||
|
|
||||||
|
def square(x: int) -> int:
|
||||||
|
return x * x
|
||||||
|
|
||||||
|
# Стиль SPython и PascalABC.NET
|
||||||
|
lst.Where(even).Select(square).Order.Println()
|
||||||
|
|
||||||
|
# Стиль Python
|
||||||
|
print(sorted(map(square,filter(even,lst))))
|
||||||
17
InstallerSamples/SPython/py14.pys
Normal file
17
InstallerSamples/SPython/py14.pys
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
students = [
|
||||||
|
{"name": "Alice", "grade": "90"},
|
||||||
|
{"name": "Bob", "grade": "85"},
|
||||||
|
{"name": "Charlie", "grade": "92"}
|
||||||
|
]
|
||||||
|
|
||||||
|
print(students)
|
||||||
|
print(type(students))
|
||||||
|
|
||||||
|
def grade_sort(d: dict[str,str]) -> int:
|
||||||
|
return int(d["grade"])
|
||||||
|
|
||||||
|
# отсортировать студентов по убыванию рейтинга
|
||||||
|
sorted_students = sorted(students, grade_sort, True)
|
||||||
|
print(sorted_students)
|
||||||
|
|
||||||
|
|
||||||
12
InstallerSamples/SPython/py15.pys
Normal file
12
InstallerSamples/SPython/py15.pys
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
def product(a: list[int], **kwargs: int) -> list[list[int]]:
|
||||||
|
repeat = kwargs['repeat']
|
||||||
|
if repeat == 1:
|
||||||
|
return [[a[i]] for i in range(len(a))]
|
||||||
|
prev = product(a, repeat = repeat - 1)
|
||||||
|
res: list[list[int]] = []
|
||||||
|
for elem in a:
|
||||||
|
for p in prev:
|
||||||
|
res.append([elem] + p)
|
||||||
|
return res
|
||||||
|
|
||||||
|
print(product([1,2,3], repeat = 3));
|
||||||
3
InstallerSamples/SPython/py16.pys
Normal file
3
InstallerSamples/SPython/py16.pys
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
import random
|
||||||
|
b = [random.randint(0, 99) for i in range(20)]
|
||||||
|
print(b)
|
||||||
5
InstallerSamples/SPython/py2.pys
Normal file
5
InstallerSamples/SPython/py2.pys
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
def ip2int( s: str ) -> int:
|
||||||
|
n = [ int(p) for p in s.split('.') ]
|
||||||
|
return n[0]*256**3 + n[1]*256**2 + n[2]*256 + n[3]
|
||||||
|
|
||||||
|
print(ip2int('127.0.0.1'))
|
||||||
5
InstallerSamples/SPython/py3.pys
Normal file
5
InstallerSamples/SPython/py3.pys
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
s = '123 456'
|
||||||
|
|
||||||
|
res = map(int,s.split)
|
||||||
|
|
||||||
|
print(res)
|
||||||
7
InstallerSamples/SPython/py4.pys
Normal file
7
InstallerSamples/SPython/py4.pys
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
def f() -> tuple[int,int]:
|
||||||
|
return (1,1)
|
||||||
|
|
||||||
|
print((1,2) != (2,3))
|
||||||
|
|
||||||
|
s = 'ds1h'
|
||||||
|
print('1' in s)
|
||||||
15
InstallerSamples/SPython/py5.pys
Normal file
15
InstallerSamples/SPython/py5.pys
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
def F( n : int) -> int:
|
||||||
|
return 1 if n == 20 else \
|
||||||
|
0 if n > 20 else \
|
||||||
|
F(n+1) + F(2*n)
|
||||||
|
|
||||||
|
graph = { 'A': {'C': 3, 'D': 1},
|
||||||
|
'B': {'C': 4, 'D': 5, 'E': 1},
|
||||||
|
'C': {'A': 3, 'B': 4, 'E': 2},
|
||||||
|
'D': {'A': 1, 'B': 5, 'E': 1},
|
||||||
|
'E': {'B': 1, 'C': 2, 'D': 1} }
|
||||||
|
|
||||||
|
print(graph,type(graph),sep = "\n")
|
||||||
|
|
||||||
|
#d = float(1)
|
||||||
|
#e = int('e')
|
||||||
2
InstallerSamples/SPython/py6.pys
Normal file
2
InstallerSamples/SPython/py6.pys
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
for x in range(10):
|
||||||
|
print(x,end = ' ')
|
||||||
11
InstallerSamples/SPython/py7.pys
Normal file
11
InstallerSamples/SPython/py7.pys
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
season = int(input())
|
||||||
|
if season == 1:
|
||||||
|
print("весна")
|
||||||
|
elif season == 2:
|
||||||
|
print("лето")
|
||||||
|
elif season == 3:
|
||||||
|
print("осень")
|
||||||
|
elif season == 4:
|
||||||
|
print("зима")
|
||||||
|
|
||||||
|
|
||||||
3
InstallerSamples/SPython/py8.pys
Normal file
3
InstallerSamples/SPython/py8.pys
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
a = [x for x in range(10) if x % 2 == 0]
|
||||||
|
|
||||||
|
print(a)
|
||||||
6
InstallerSamples/SPython/py9.pys
Normal file
6
InstallerSamples/SPython/py9.pys
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
d = {'1': [1, 2]}
|
||||||
|
|
||||||
|
if '1' in d:
|
||||||
|
print(true)
|
||||||
|
|
||||||
|
|
||||||
5
InstallerSamples/SPython/random.pys
Normal file
5
InstallerSamples/SPython/random.pys
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
#unit random
|
||||||
|
import PABCSystem
|
||||||
|
|
||||||
|
def randint(a: int, b: int) -> int:
|
||||||
|
return PABCSystem.random(a, b)
|
||||||
8
InstallerSamples/SPython/random1.pys
Normal file
8
InstallerSamples/SPython/random1.pys
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#unit random
|
||||||
|
import PABCSystem
|
||||||
|
|
||||||
|
def random() -> float:
|
||||||
|
return PABCSystem.random()
|
||||||
|
|
||||||
|
def randint(a: int, b: int) -> int:
|
||||||
|
return PABCSystem.random(a, b)
|
||||||
11
InstallerSamples/SPython/set_example.pys
Normal file
11
InstallerSamples/SPython/set_example.pys
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
from time import time
|
||||||
|
|
||||||
|
s: set[int] = set()
|
||||||
|
t1 = time()
|
||||||
|
|
||||||
|
for i in range(1, 1000000):
|
||||||
|
s |= {i}
|
||||||
|
|
||||||
|
t2 = time()
|
||||||
|
print(t2 - t1)
|
||||||
|
print(len(s))
|
||||||
18
InstallerSamples/SPython/time_measurement_example.pas
Normal file
18
InstallerSamples/SPython/time_measurement_example.pas
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
begin
|
||||||
|
var n := 60000;
|
||||||
|
var t1 := Milliseconds;
|
||||||
|
var sm := 0.0;
|
||||||
|
var i := 1.0;
|
||||||
|
while i < n do
|
||||||
|
begin
|
||||||
|
var j := 1.0;
|
||||||
|
while j < n do
|
||||||
|
begin
|
||||||
|
sm += 1.0 / i / j;
|
||||||
|
j += 1;
|
||||||
|
end;
|
||||||
|
i += 1;
|
||||||
|
end;
|
||||||
|
var t2 := Milliseconds;
|
||||||
|
print(t2 - t1);
|
||||||
|
end.
|
||||||
16
InstallerSamples/SPython/time_measurement_example.pys
Normal file
16
InstallerSamples/SPython/time_measurement_example.pys
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
import time
|
||||||
|
|
||||||
|
n = 60000
|
||||||
|
start = time.time()
|
||||||
|
sm: float = 0
|
||||||
|
|
||||||
|
i = 1.0
|
||||||
|
while i < n:
|
||||||
|
j = 1.0
|
||||||
|
while j < n:
|
||||||
|
sm += 1.0 / i / j
|
||||||
|
j += 1
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
end = time.time();
|
||||||
|
print(end - start)
|
||||||
18
InstallerSamples/SPython/unit_example.pys
Normal file
18
InstallerSamples/SPython/unit_example.pys
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Рекурсивная функция вычисления факториала
|
||||||
|
def factorial(n: int)-> bigint:
|
||||||
|
if n == 0:
|
||||||
|
return 1
|
||||||
|
return n * factorial(n - 1)
|
||||||
|
|
||||||
|
|
||||||
|
# Не рекурсивная функция вычисления числа Фибоначчи
|
||||||
|
def fibonacci(n: int)-> bigint:
|
||||||
|
if n <= 1:
|
||||||
|
return n
|
||||||
|
f1: bigint = 0
|
||||||
|
f2: bigint = 1
|
||||||
|
for i in range(n - 1):
|
||||||
|
t = f1 + f2
|
||||||
|
f1 = f2
|
||||||
|
f2 = t
|
||||||
|
return f2
|
||||||
15
InstallerSamples/SPython/unit_use_example.pas
Normal file
15
InstallerSamples/SPython/unit_use_example.pas
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
Uses unit_example;
|
||||||
|
|
||||||
|
const N: integer = 10;
|
||||||
|
|
||||||
|
begin
|
||||||
|
println('Последовательность чисел Фибоначчи:');
|
||||||
|
for var i := 1 to N do
|
||||||
|
println('F(' + i + ')=', fibonacci(i));
|
||||||
|
println();
|
||||||
|
|
||||||
|
println('Последовательность факториалов:');
|
||||||
|
for var i := 1 to N do
|
||||||
|
println(i + '!=', factorial(i));
|
||||||
|
println();
|
||||||
|
end.
|
||||||
19
InstallerSamples/SPython/unit_use_example.pys
Normal file
19
InstallerSamples/SPython/unit_use_example.pys
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
from unit_example import fibonacci as F, factorial as fact
|
||||||
|
|
||||||
|
N = 10
|
||||||
|
|
||||||
|
fibs = [F(i) for i in range(1, N + 1)]
|
||||||
|
print("Последовательность чисел Фибоначчи:")
|
||||||
|
i = 0
|
||||||
|
for fib_num in fibs:
|
||||||
|
i += 1
|
||||||
|
print('F(' + str(i) + ')\t=', fib_num)
|
||||||
|
print()
|
||||||
|
|
||||||
|
facts = [fact(i) for i in range(1, N + 1)]
|
||||||
|
print("Последовательность факториалов:")
|
||||||
|
i = 0
|
||||||
|
for fact_num in facts:
|
||||||
|
i += 1
|
||||||
|
print(str(i) + '!\t=', fact_num)
|
||||||
|
print()
|
||||||
|
|
@ -1 +1 @@
|
||||||
3.11.0.3654
|
3.11.0.3661
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,10 @@ SectionEnd
|
||||||
LangString DESC_Minimal ${LANG_ENGLISH} "Minimal"
|
LangString DESC_Minimal ${LANG_ENGLISH} "Minimal"
|
||||||
LangString DESC_PascalABCNET_Language ${LANG_RUSSIAN} "Язык PascalABC.NET"
|
LangString DESC_PascalABCNET_Language ${LANG_RUSSIAN} "Язык PascalABC.NET"
|
||||||
LangString DESC_PascalABCNET_Language ${LANG_ENGLISH} "PascalABC.NET language"
|
LangString DESC_PascalABCNET_Language ${LANG_ENGLISH} "PascalABC.NET language"
|
||||||
|
|
||||||
|
LangString DESC_SPython_Language ${LANG_RUSSIAN} "Язык SPython"
|
||||||
|
LangString DESC_SPython_Language ${LANG_ENGLISH} "SPython language"
|
||||||
|
|
||||||
LangString DESC_Compiler ${LANG_RUSSIAN} "Компилятор"
|
LangString DESC_Compiler ${LANG_RUSSIAN} "Компилятор"
|
||||||
LangString DESC_Compiler ${LANG_ENGLISH} "Compiler"
|
LangString DESC_Compiler ${LANG_ENGLISH} "Compiler"
|
||||||
LangString DESC_Envr ${LANG_RUSSIAN} "Оболочка"
|
LangString DESC_Envr ${LANG_RUSSIAN} "Оболочка"
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
SectionGroup $(DESC_InputLanguages) Languages
|
SectionGroup $(DESC_InputLanguages) Languages
|
||||||
!include sect_PascalABCParser.nsh
|
!include sect_PascalABCParser.nsh
|
||||||
|
!include sect_SPythonParser.nsh
|
||||||
SectionGroupEnd
|
SectionGroupEnd
|
||||||
|
|
||||||
SectionGroup $(DESC_Envr) Envr
|
SectionGroup $(DESC_Envr) Envr
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
!define VERSION '3.11.0.3654'
|
!define VERSION '3.11.0.3661'
|
||||||
|
|
|
||||||
11
ReleaseGenerators/RebuildStandartModulesSPython.pas
Normal file
11
ReleaseGenerators/RebuildStandartModulesSPython.pas
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
uses
|
||||||
|
// SPython
|
||||||
|
//SPythonSystem, SPythonHidden,
|
||||||
|
time1,
|
||||||
|
SPythonSystemPys, itertools, math
|
||||||
|
;
|
||||||
|
|
||||||
|
begin
|
||||||
|
writeln(cos(pi));
|
||||||
|
readln;
|
||||||
|
end.
|
||||||
|
|
@ -179,6 +179,13 @@
|
||||||
File ..\bin\Lib\Tasks1Arr.pcu
|
File ..\bin\Lib\Tasks1Arr.pcu
|
||||||
File ..\bin\Lib\WPF.pcu
|
File ..\bin\Lib\WPF.pcu
|
||||||
|
|
||||||
|
File ..\bin\Lib\SPythonHidden.pcu
|
||||||
|
File ..\bin\Lib\SPythonSystem.pcu
|
||||||
|
File ..\bin\Lib\time1.pcu
|
||||||
|
File ..\bin\Lib\SPythonSystemPys.pcu
|
||||||
|
File ..\bin\Lib\itertools.pcu
|
||||||
|
File ..\bin\Lib\math.pcu
|
||||||
|
|
||||||
File ..\bin\Lib\PABCRtl.dll
|
File ..\bin\Lib\PABCRtl.dll
|
||||||
File ..\bin\Lib\HelixToolkit.Wpf.dll
|
File ..\bin\Lib\HelixToolkit.Wpf.dll
|
||||||
File ..\bin\Lib\HelixToolkit.dll
|
File ..\bin\Lib\HelixToolkit.dll
|
||||||
|
|
@ -271,6 +278,13 @@
|
||||||
${AddFile} "Tasks1Arr.pcu"
|
${AddFile} "Tasks1Arr.pcu"
|
||||||
${AddFile} "WPF.pcu"
|
${AddFile} "WPF.pcu"
|
||||||
|
|
||||||
|
;SPython
|
||||||
|
${AddFile} "SPythonHidden.pcu"
|
||||||
|
${AddFile} "SPythonSystem.pcu"
|
||||||
|
${AddFile} "time1.pcu"
|
||||||
|
${AddFile} "SPythonSystemPys.pcu"
|
||||||
|
${AddFile} "itertools.pcu"
|
||||||
|
${AddFile} "math.pcu"
|
||||||
|
|
||||||
${AddFile} "turtle.png"
|
${AddFile} "turtle.png"
|
||||||
|
|
||||||
|
|
@ -379,6 +393,15 @@
|
||||||
File ..\bin\Lib\Мозаика.pas
|
File ..\bin\Lib\Мозаика.pas
|
||||||
File ..\bin\Lib\WPF.pas
|
File ..\bin\Lib\WPF.pas
|
||||||
|
|
||||||
|
;SPython
|
||||||
|
File ..\bin\Lib\SPythonHidden.pas
|
||||||
|
File ..\bin\Lib\SPythonSystem.pas
|
||||||
|
File ..\bin\Lib\time1.pas
|
||||||
|
|
||||||
|
File ..\bin\Lib\SPythonSystemPys.pys
|
||||||
|
File ..\bin\Lib\itertools.pys
|
||||||
|
File ..\bin\Lib\math.pys
|
||||||
|
|
||||||
File ..\bin\Lib\__RedirectIOMode.vb
|
File ..\bin\Lib\__RedirectIOMode.vb
|
||||||
File ..\bin\Lib\VBSystem.vb
|
File ..\bin\Lib\VBSystem.vb
|
||||||
|
|
||||||
|
|
@ -458,6 +481,15 @@
|
||||||
${AddFile} "Мозаика.pas"
|
${AddFile} "Мозаика.pas"
|
||||||
${AddFile} "WPF.pas"
|
${AddFile} "WPF.pas"
|
||||||
|
|
||||||
|
;SPython
|
||||||
|
${AddFile} "SPythonHidden.pas"
|
||||||
|
${AddFile} "SPythonSystem.pas"
|
||||||
|
${AddFile} "time1.pas"
|
||||||
|
|
||||||
|
${AddFile} "SPythonSystemPys.pys"
|
||||||
|
${AddFile} "itertools.pys"
|
||||||
|
${AddFile} "math.pys"
|
||||||
|
|
||||||
|
|
||||||
${AddFile} "__RedirectIOMode.vb"
|
${AddFile} "__RedirectIOMode.vb"
|
||||||
${AddFile} "VBSystem.vb"
|
${AddFile} "VBSystem.vb"
|
||||||
|
|
|
||||||
48
ReleaseGenerators/sect_SPythonParser.nsh
Normal file
48
ReleaseGenerators/sect_SPythonParser.nsh
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
Section $(DESC_SPython_Language) SPythonSection
|
||||||
|
SectionIn 1 2
|
||||||
|
|
||||||
|
; Установка файлов SPython
|
||||||
|
SetOutPath "$INSTDIR"
|
||||||
|
File "..\bin\SPythonParser.dll"
|
||||||
|
File "..\bin\SPythonLanguageInfo.dll"
|
||||||
|
File "..\bin\SPythonStandardTreeConverter.dll"
|
||||||
|
File "..\bin\SPythonSyntaxTreeVisitor.dll"
|
||||||
|
|
||||||
|
${AddFile} "SPythonParser.dll"
|
||||||
|
${AddFile} "SPythonLanguageInfo.dll"
|
||||||
|
${AddFile} "SPythonStandardTreeConverter.dll"
|
||||||
|
${AddFile} "SPythonSyntaxTreeVisitor.dll"
|
||||||
|
|
||||||
|
; Файл подсветки синтаксиса
|
||||||
|
SetOutPath "$INSTDIR\Highlighting"
|
||||||
|
File "..\bin\Highlighting\SPython.xshd"
|
||||||
|
${AddFile} "SPython.xshd"
|
||||||
|
|
||||||
|
; Оптимизация .NET библиотек через NGEN
|
||||||
|
SetOutPath "$INSTDIR"
|
||||||
|
Push "SPythonParser.dll"
|
||||||
|
Call NGEN
|
||||||
|
Push "SPythonLanguageInfo.dll"
|
||||||
|
Call NGEN
|
||||||
|
Push "SPythonStandardTreeConverter.dll"
|
||||||
|
Call NGEN
|
||||||
|
Push "SPythonSyntaxTreeVisitor.dll"
|
||||||
|
Call NGEN
|
||||||
|
|
||||||
|
DeleteRegKey HKCR "pys"
|
||||||
|
;insalling pys file type
|
||||||
|
ReadRegStr $R0 HKCR ".pys" ""
|
||||||
|
StrCmp $R0 "PascalABCNET.SPythonParser" 0 +2
|
||||||
|
DeleteRegKey HKCR "PascalABCNET.SPythonParser"
|
||||||
|
WriteRegStr HKCR ".pys" "" "PascalABCNET.SPythonParser"
|
||||||
|
WriteRegStr HKCR "PascalABCNET.SPythonParser" "" "SPython Program"
|
||||||
|
WriteRegStr HKCR "PascalABCNET.SPythonParser\DefaultIcon" "" "$INSTDIR\Ico\pas.ico"
|
||||||
|
ReadRegStr $R0 HKCR "PascalABCNET.SPythonParser\shell\open\command" ""
|
||||||
|
StrCmp $R0 "" 0 no_nshopen
|
||||||
|
WriteRegStr HKCR "PascalABCNET.SPythonParser\shell" "" "open"
|
||||||
|
WriteRegStr HKCR "PascalABCNET.SPythonParser\shell\open\command" "" '"$INSTDIR\PascalABCNET.exe" "%1"'
|
||||||
|
no_nshopen:
|
||||||
|
WriteRegStr HKCR "PascalABCNET.SPythonParser\shell\compile" "" "Компилировать"
|
||||||
|
WriteRegStr HKCR "PascalABCNET.SPythonParser\shell\compile\command" "" '"$INSTDIR\pabcnetc.exe" "%1"'
|
||||||
|
|
||||||
|
SectionEnd
|
||||||
|
|
@ -18,6 +18,7 @@ dotnet build -c Release --no-incremental PascalABCNET.sln
|
||||||
|
|
||||||
cd ReleaseGenerators
|
cd ReleaseGenerators
|
||||||
..\bin\pabcnetc RebuildStandartModules.pas /rebuild
|
..\bin\pabcnetc RebuildStandartModules.pas /rebuild
|
||||||
|
..\bin\pabcnetc RebuildStandartModulesSPython.pas
|
||||||
@IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
@IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
cd PABCRtl
|
cd PABCRtl
|
||||||
|
|
@ -33,6 +34,7 @@ ExecHide.exe gacutil.exe /u PABCRtl
|
||||||
ExecHide.exe gacutil.exe /i ..\bin\Lib\PABCRtl.dll
|
ExecHide.exe gacutil.exe /i ..\bin\Lib\PABCRtl.dll
|
||||||
|
|
||||||
..\bin\pabcnetc RebuildStandartModules.pas /rebuild
|
..\bin\pabcnetc RebuildStandartModules.pas /rebuild
|
||||||
|
..\bin\pabcnetc RebuildStandartModulesSPython.pas
|
||||||
@IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
@IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
15
bin/Lib/time1.pas
Normal file
15
bin/Lib/time1.pas
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
unit time1;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
function time(): real;
|
||||||
|
|
||||||
|
function forty_two(): real;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
function time() : real := DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||||
|
|
||||||
|
function forty_two() : real := 42;
|
||||||
|
|
||||||
|
end.
|
||||||
Loading…
Reference in a new issue