Архив автора: admin

Python – использование format в строках

Внутри строки мы можем указать как фиксированный текст, так и часть текста, определяемого функцией format, который будет состоять из отдельно задаваемых участков:

print(“This cat has {0} kittens and a {1}”.format(2,”tail”))

Вместо использования номеров внутри фигурных скобок можно в них сразу задать значение переменной – a,b,c:

print(‘quantity: ({a}, {b}, {c})’.format(a=5,b=2,c=4)) Читать

Python – installation

To install Python on your computer, simply search Google for download python and follow the first link to www.python.org/downloads

The easiest way is to click on the bright button with the latest version of Python and then follow the installation process.

In addition to Python itself, you will probably need to install additional programs, which we will discuss next. When installing Python, remember that it is an interpretive programming language. If you write the code in notepad, it won’t work. And the code doesn’t need to be compiled like in C++. To run your code, you use either the built-in interpreter – Python 3.6.exe, or you can activate the interpreter in other text editors or programming environments.