Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

The laboratory work 2

.docx
Скачиваний:
11
Добавлен:
11.11.2022
Размер:
625.63 Кб
Скачать

The laboratory work 2

Exercise 1: Accept two numbers from the user and calculate multiplication.

Result:

Exercise 2: Display “My Name Is James” as “My**Name**Is**James” using output formatting of a print() function.

Expected Output:

Use print() statement formatting to display the ** separator between each word.

For example: print('My', 'Name', 'Is', 'James') will display MyNameIsJames

So use one of the formatting argument of print() to turn the output into My**Name**Is**James

Result:

Exercise 3: Convert decimal number to octal using print() output formatting

Expected Output:

Display decimal number 8 as 10

Result:

Exercise 4: Write all content of a given file into a new file by skipping line number 5.

Result:

Exercise 5: Format the following data using a string.format() method.

Result:

Exercise 6: Read line number 4 from the following file

Result:

Соседние файлы в предмете Администрирование систем и сетей