Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
魏老師的挑戰狀2
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
請用少於 50 (UPD: 45) 個字元的 Python Code 將字串 s 每四個字元為一組反序呈現( s 的長度是 4 的倍數), 舉例 當 s="abcd1234efgh5678"
目前允許多行程式碼: 換行算一個字元, 一層縮排算一個字元
'''
s = 'EFGHABCD56781234'
b=''
while s:b+=s[-4:];s=s[:-4]
s=b
print(s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment