CertyRush
Đang tải...
C CertyRush
Câu hỏi free preview

Câu 10: PCED-30-02: PCED - Certified Entry-Level Data Analyst with Python

You are working with city names entered by users. These names may contain inconsistent capitalization and unwanted spaces. To standardize the data, you want to:Remove any leading or trailing whitespace, andCapitalize the first letter of each word (e.g., convert "new york" to "New York"). For example:"New york " → "New…

Nội dung câu hỏi

You are working with city names entered by users. These names may contain inconsistent capitalization and unwanted spaces. To standardize the data, you want to:Remove any leading or trailing whitespace, andCapitalize the first letter of each word (e.g., convert "new york" to "New York"). For example:"New york " → "New York""lOS ANGELES" → "Los Angeles"You are given a variable city that contains the raw input. Which line of code correctly updates the value of cleaned_city to apply the required transformation? Select the best answer.

Các lựa chọn

Đáp án được giữ gọn theo nhãn A, B, C, D trong phần bình chọn tương tác.

  1. A. cleaned_city = city.strip().capitalize()
  2. B. cleaned_city = city.upper().replace(" ", "")
  3. C. cleaned_city = city.upper().strip()
  4. D. cleaned_city = city.strip().title() — đáp án hiện tại

Cộng đồng

0 bình luận công khai. Tên thành viên được ẩn một phần.

Chưa có bình luận. Mở giao diện tương tác để bắt đầu thảo luận.

Câu hỏi liền kề