Флашкарти: Python Data Handling and String Formatting — 20 карти

Всички карти

1Въпрос

Dictionary comparison — method?

Отговор

Use `==` for equality; `cmp()` in Python 2.

2Въпрос

keys() — returns?

Отговор

A view object of all dictionary keys.

3Въпрос

dict() — creates?

Отговор

A dictionary from sequences of key-value pairs.

4Въпрос

KeyError — when?

Отговор

Accessing a non-existent dictionary key.

5Въпрос

String format() — purpose?

Отговор

Insert variables into strings dynamically.

6Въпрос

!r and !s — in format?

Отговор

Control object representation: repr() vs str().

7Въпрос

String repetition — operator?

Отговор

The `*` operator repeats strings.

8Въпрос

String slicing — syntax?

Отговор

[start:stop:step] to extract substrings.

9Въпрос

count() — does?

Отговор

Counts occurrences of a substring in a string.

10Въпрос

replace() — does?

Отговор

Replaces substrings within a string.

11Въпрос

open() — mode?

Отговор

Specifies file access: 'r', 'w', etc.

12Въпрос

read(n) — reads?

Отговор

n characters from an open file.

13Въпрос

readline() — reads?

Отговор

A single line from a file.

14Въпрос

try-except-else — purpose?

Отговор

Handle exceptions during file operations.

15Въпрос

Python file modes?

Отговор

'r' for read, 'w' for write, 'b' for binary.

16Въпрос

Python data types?

Отговор

Int, float, string, list, tuple, dict.

17Въпрос

Mutable data structure?

Отговор

List and dict are mutable; tuple is immutable.

18Въпрос

Set — characteristics?

Отговор

Unordered, unique elements, supports set operations.

19Въпрос

Variables — rules?

Отговор

Start with letter/underscore, case-sensitive.

20Въпрос

Functions — define with?

Отговор

Using `def` keyword, reusable code blocks.

Тествайте се с теста

Тествайте знанията си с 10 въпроса по Python Data Handling and String Formatting.

1. How do you create a Python dictionary from a list of key-value pair tuples?

2. What is the purpose of the 'cmp()' function in Python 2 when used with dictionaries?

Вземете теста →

Прочетете листа за преговор

Прегледайте пълния курс в листа за преговор за Python Data Handling and String Formatting.

Вижте листа за преговор →

Similar courses

Създайте свои собствени флашкарти

Импортирайте курса си и AI генерира флашкарти за 30 секунди.

Генератор на флашкарти