Python Challenge for Beginner | rosalind
Notation: Those Challenges come from Rosalind
Introduction
Function:
|
Function test:
|
hello function 6
Let the fun begin!
Calculate
Link
Given: Two positive integers a and b, each less than 1000.
Return: The integer corresponding to the square of the hypotenuse of the right triangle whose legs have lengths a and b.
in: 3 5 out: 34
|
String splice
Link
Given: A string s of length at most 200 letters and four integers a, b, c and d.
Return: The slice of this string from indices a through b and c through d (with space in between), inclusively. In other words, we should include elements s[b] and s[d] in our slice.
in: HumptyDumptysatonawallHumptyDumptyhadagreatfallAlltheKingshorsesandalltheKingsmenCouldntputHumptyDumptyinhisplaceagain. 22 27 97 102 out: Humpty Dumpty
|
loop
Link
Given: Two positive integers a and b (a<b<10000).
Return: The sum of all odd integers from a through b, inclusively.
in: 100 200 out: 7500
|
Reading and writing
Link
Given: A file containing at most 1000 lines.
Return: A file containing all the even-numbered lines from the original file. Assume 1-based numbering of lines.
|
Words count
Link
Given: A string s of length at most 10000 letters.
Return: The number of occurrences of each word in s, where words are separated by spaces. Words are case-sensitive, and the lines in the output can be in any order.
In: We tried list and we tried dicts also we tried Zen Out: and 1 We 1 tried 3 dicts 1 list 1 we 2 also 1 Zen 1
|
Python Challenge for Beginner | rosalind