Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

140 строки
3.5 KiB
Markdown

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# Отчёт по лабораторной работе №1
Криштул Александр, А-03-23
## Знакомство с программой-интерпретатором
```py
>>> print('Hello!')
Hello!
>>> h=input('Your name: ')
Your name: Alexander
>>> print(h)
Alexander
>>> exit()
```
## Инструкции настройки рабочего каталога среды
```py
>>> import os
>>> os.chdir('C:\\Users\\User\\Desktop\\LR\\python-labs\\TEMA1')
>>> os.getcwd()
'C:\\Users\\User\\Desktop\\LR\\python-labs\\TEMA1'
```
## pr0.py
Содержимое файла:
```py
print('Hello!')
h=input('Your name: ')
print(h)
```
Результат выполнения программы:
```
>>>
========== RESTART: C:\Users\User\Desktop\LR\python-labs\TEMA1\pr0.py ==========
Hello!
Your name: Alex
Alex
```
## prb1.py
Содержимое файла:
```py
name = input("Как Вас зовут? ")
print("Привет,", name)
```
Результат выполнения программы:
```
>>>
= RESTART: C:\Users\User\Desktop\LR\python-labs\TEMA1\prb1.py
Как Вас зовут? Alexander
Привет, Alexander
```
## __pycache__ и содержимое файла Pr0.cpython-34.pyc
Содержимое файла:
```
a
µhr г  @ s& e d ѓ edѓZddlZe dЎ dS )zHello!z Your name: й Nz*C:\Users\User\Desktop\LR\python-labs\TEMA1)ЪprintЪinputЪosЪchdir© r r ъ1C:\Users\User\Desktop\LR\python-labs\TEMA1\pr0.pyЪ<module> s 
```
В папке __pycache__ хранится скомпилированный двоичный код, который нужен ля оптимизации загрузки и запуска программы.
## Раздел помощи (Help)
```py
>>> help(print)
Help on built-in function print in module builtins:
print(...)
print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
Prints the values to a stream, or to sys.stdout by default.
Optional keyword arguments:
file: a file-like object (stream); defaults to the current sys.stdout.
sep: string inserted between values, default a space.
end: string appended after the last value, default a newline.
flush: whether to forcibly flush the stream.
```
```py
>>> help(input)
Help on built-in function input in module builtins:
input(prompt=None, /)
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.
```
## Файл tdemo_chaos.py
Содержание файла:
```py
# 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)
```
Результат выполнение программы:
<image src="figure0.png">
## Демонстрация работы модуля Turtle на примере Clock
<image src="figure1.png">