Question about the number of Python list cases. Please help me

Asked 1 years ago, Updated 1 years ago, 81 views

For example, suppose you have a list of [a,1,2,]
a1, a2, 1a, 2a, 12, 21 Is there a way to write atom mixed in this way? ㅜ<
Do not include a, 1, 2, and a12.
And the numeric string should be converted into a string and then mixed, but I don't know....
Please teach me <
I tried to set the list name to list_data.

python atom

2022-09-22 14:32

1 Answers

It's Atom, it's list_data, it's all over the place, and let's do it with strong paper, pencil, and hand.

1. First, look at the list carefully. Remember that there are three items in total: a, 1 and 2.

2. Since there are three items, write a on the paper three times vertically. It's going to be like this.

a
a
a

3. Put a, a, 1, and 2 next to a once. It's going to be like this.

aa
a1
a2

4. Oh! But the teacher said that the same thing should not come out twice like aa. Clear aaa with a murmur. It's going to be like this.

a1
a2

5. Write each item three times vertically, put another item next to it, and repeat clearing if there are overlapping items. It's going to be like this when it's done.

a1
a2
1a
12
2a
21

This is the output you want. Why can't you do what you can do with paper, pencils, and hands, Python?

The key is two tours and conditional handling within the tour. Try reading Python Basic Course patiently from start to finish. You can do it.


2022-09-22 14:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.