selfteaching / selfteaching/selfteaching-python-camp

Day05 字符串的基本处理中所有单词按 a…z 升序排列不理解

Open
#3,386 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
151
Forks
875
PR merge metrics
No merged PRs in 30d

Description

a=new3_str.split()
b=sorted(a)
new4_str=' '.join(b)
print (new4_str)

这个代码中,new4_str=' '.join(b)是什么意思?
我明白的是:str.split(sep=None, maxsplit=-1) 是返回一个由字符串内单词组成的列表;sorted(iterable, *, key=None, reverse=False) 根据 iterable 中的项返回一个新的降序列表。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the shown new4_str=' '.join(b) expression and consult Python's string join documentation. Run the provided snippet to observe the resulting string, then document what the expression does and how it relates to split() and sorted().

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.