iT邦幫忙

2025 iThome 鐵人賽

DAY 4
0
AI & Data

Rosalind 生物資訊解題系統系列 第 4

Day04 | Rosalind 生資解題 - IN3. Strings and Lists

  • 分享至 

  • xImage
  •  

Day04 | Rosalind 生資解題 - IN3. Strings and Lists

題目連結:https://rosalind.info/problems/ini3/

https://ithelp.ithome.com.tw/upload/images/20250916/20125192oe17NCMMKl.png

給一長串的字串資料,然後a, b, c, d 4個數字
需切出字串[a~b]、字串[c~d]的位置,連接後印出來
(須包含字串[b]、字串[d]的位置)

輸入

HumptyDumptysatonawallHumptyDumptyhadagreatfallAlltheKingshorsesandalltheKingsmenCouldntputHumptyDumptyinhisplaceagain.
22 27 97 102

輸出

Humpty Dumpty

程式碼:

s = "HumptyDumptysatonawallHumptyDumptyhadagreatfallAlltheKingshorsesandalltheKingsmenCouldntputHumptyDumptyinhisplaceagain"

a, b, c, d = 22, 27, 97, 102
# a, b, c, d = map(int, input().split()) # 開啟手動輸入數字

print(s[a:b+1], s[c:d+1])

上一篇
Day03 | Rosalind 生資解題 - IN2. Variables and Some Arithmetic
下一篇
Day05 | Rosalind 生資解題 - IN4. Conditions and Loops +奇偶數判斷
系列文
Rosalind 生物資訊解題系統7
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言