[Weekly Summary] Week 185

to sum up

1. It is difficult to write high-quality code in a competitive environment

2. Forgotten Python basics, some usages should be checked now

 

A: reformatted string

  • Algorithm: Extract digital sequence D and letter sequence A, and splice according to the length of A and D.
    • When  D = [1,2,3,4], A = ['a', 'b', 'c'], the result is: "1a2b3c4"
    • When D = [1,2,3] and A = ['a', 'b', 'c', 'd'], the result is: "a1b2c3d"
    • When D = [1,2,3] and A = ['a', 'b', 'c'], the result is: "1a2b3c" or "a1b2c3"
    • How to avoid writing three judgment sentences?

 

  • What needs to be improved: The code is not streamlined enough, and there is too much code that repeats logic.

B: A la carte display table

Guess you like

Origin www.cnblogs.com/remly/p/12735702.html