diff --git a/Pr0.py b/Pr0.py new file mode 100644 index 0000000..5428f63 --- /dev/null +++ b/Pr0.py @@ -0,0 +1,5 @@ +#Программа по Теме 1 Степанищев Виктор Романович +print('Hello') +h=input('Your name=') +import os +os.chdir(r"/home/byvs/MPEI/Programming Python/Stepanishchev/TEMA1/") diff --git a/figure0.png b/figure0.png new file mode 100644 index 0000000..6a230fc Binary files /dev/null and b/figure0.png differ diff --git a/figure1.png b/figure1.png new file mode 100644 index 0000000..2ee3f90 Binary files /dev/null and b/figure1.png differ diff --git a/prb1.py b/prb1.py new file mode 100644 index 0000000..587b019 --- /dev/null +++ b/prb1.py @@ -0,0 +1,2 @@ +name = input("Как Вас зовут? ") +print("Привет,", name) diff --git a/report.md b/report.md new file mode 100644 index 0000000..8ce8e8f --- /dev/null +++ b/report.md @@ -0,0 +1,96 @@ +#Отчёт по теме 1 + +Степанищев Виктор, А-03-23 + +## 1 Знакомство с интерпретатором + +Введение инструкций в окно интерпретатора +``` +>>>print('Hello') +Hello +>>>h=input('Your name=') +Your name=Viktor +>>>exit() +``` + +## 2 Знакомство с интерактивной оболочкой IDLE + +Настройка текущего каталога +``` +import os +os.chdir(r"/home/byvs/MPEI/Programming Python/python-labs/TEMA1/") +``` + +Создание Pr0.py в рабочем каталоге и его запуск тремя способами: import Pr0, F5, 'Запустить модуль' + +``` +#Программа по Теме 1 Степанищев Виктор Романович +print('Hello') +h=input('Your name=') +import os +os.chdir(r"/home/byvs/MPEI/Programming Python/Stepanishchev/TEMA1/") +``` + +Запуск prb1.py +``` +>>> import prb1 +Как Вас зовут? Viktor +Привет, Viktor +``` + +В папке _pycache_ хранится двоичный скомпилированный код, который нужен для оптимизации загрузки и запуска программы + +Раздел помощи help в главном меню IDLE предлагает следующие виды помощи: документацию по IDLE, доку по Python +и наглядную демонстрацию работы модуля Turtle + +``` +>>>help(print) +Help on built-in function print in module builtins: + +print(*args, sep=' ', end='\n', file=None, flush=False) + Prints the values to a stream, or to sys.stdout by default. + + sep + string inserted between values, default a space. + end + string appended after the last value, default a newline. + file + a file-like object (stream); defaults to the current sys.stdout. + flush + whether to forcibly flush the stream. + + +>>>help(print), help(input) +Help on built-in function print in module builtins: + +print(*args, sep=' ', end='\n', file=None, flush=False) + Prints the values to a stream, or to sys.stdout by default. + + sep + string inserted between values, default a space. + end + string appended after the last value, default a newline. + file + a file-like object (stream); defaults to the current sys.stdout. + flush + whether to forcibly flush the stream. + +Help on built-in function input in module builtins: + +input(prompt='', /) + Read a string from standard input. The trailing newline is stripped. + + The prompt string, if given, is printed to standard output without a + trailing newline before reading input. + + If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError. + On *nix systems, readline is used if available. + +(None, None) +``` + +Результат работы программы tdemo_chaos.py : + + +Демонстрация работы модуля Turtle на примере clock из Turtle Demo в выпадающем меню help: + \ No newline at end of file diff --git a/tdemo_chaos.py b/tdemo_chaos.py new file mode 100644 index 0000000..6a45d0d --- /dev/null +++ b/tdemo_chaos.py @@ -0,0 +1,59 @@ +# File: tdemo_chaos.py +# Author: Gregor Lingl +# Date: 2009-06-24 + +# A demonstration of chaos + +from turtle import * + +N = 80 + +def f(x): + return 3.9*x*(1-x) + +def g(x): + return 3.9*(x-x**2) + +def h(x): + return 3.9*x-3.9*x*x + +def jumpto(x, y): + penup(); goto(x,y) + +def line(x1, y1, x2, y2): + jumpto(x1, y1) + pendown() + goto(x2, y2) + +def coosys(): + line(-1, 0, N+1, 0) + line(0, -0.1, 0, 1.1) + +def plot(fun, start, color): + pencolor(color) + x = start + jumpto(0, x) + pendown() + dot(5) + for i in range(N): + x=fun(x) + goto(i+1,x) + dot(5) + +def main(): + reset() + setworldcoordinates(-1.0,-0.1, N+1, 1.1) + speed(0) + hideturtle() + coosys() + plot(f, 0.35, "blue") + plot(g, 0.35, "green") + plot(h, 0.35, "red") + # Now zoom in: + for s in range(100): + setworldcoordinates(0.5*s,-0.1, N+1, 1.1) + return "Done!" + +if __name__ == "__main__": + main() + mainloop()