Neural Sync Active
Jan 2026 - Python - Week 6 - Strings 2 - Graded
Registry Synced
Jan 2026 - Python - Week 6 - Strings 2 - Graded
524 words
3 min read
Strings 2 - Graded
Course: Jan 2026 - Python
Strings 2 - Graded
Submission deadline has passed for this assignment
Due Mar 25, 2026 at 11:59 PM IST
Instructions
Use "Test Run" to verify your code with public test cases.
Press "Submit" to have your assignment evaluated.
You can submit your assignment multiple times up until the deadline.
Make sure to submit your final code by the deadline to receive your score.
Summary
100 out of100
Score
Public Tests
3/3 Passed
Submitted on Mar 25, 2026 at 2:26 PM IST
Private Tests
3/3 Passed
Submitted on Mar 25, 2026 at 2:26 PM IST
**Change in eligibility criteria to write oppe2 exam: A5>=40/100 AND A6>=40/100 AND A7>=40/100 AND A8>=40/100. and becoming eligible to give the end term exam.
Even Characters first and Odd Characters reversed**
Given a string, return a string with the characters in the even indices first and the characters in the odd indices next but in reversed order.
Example For the input
"abcde",even chars = "ace" odd chars = "bd"; odd chars reversed = "db" result = "acedb"
Template Code(Click to Expand)
def even_first_odd_reversed(s: str) -> str: '''Return a string with the characters in the even indices first and the characters in the odd indices reversed next. Arguments: s: str - the input string Return: str - modified string Example: >>> even_first_odd_reversed('abcde') 'acedb' >>> even_first_odd_reversed('python') 'ptonhy' ''' ...
NOTE: You can use the below tools for working out and debugging. Click to open them in new tab.
Public Tests ( 3/3 )
Case 1
Input:
textis_equal(even_first_odd_reversed('abcde'), 'acedb')
Expected Output:
text'acedb'
Actual Output:
text'acedb'
Case 2
Input:
textis_equal(even_first_odd_reversed('python'), 'ptonhy')
Expected Output:
text'ptonhy'
Actual Output:
text'ptonhy'
Case 3
Input:
textis_equal(even_first_odd_reversed('abracadabra'), 'arcdbaraaab')
Expected Output:
text'arcdbaraaab'
Actual Output:
text'arcdbaraaab'
Private Tests ( 3/3 )
Case 1
Input:
textis_equal(even_first_odd_reversed('1'), '1') is_equal(even_first_odd_reversed('123'), '132')
Expected Output:
text'1' '132'
Actual Output:
text'1' '132'
Case 2
Input:
textis_equal(even_first_odd_reversed('this is a line'), 'ti salnei ish')
Expected Output:
text'ti salnei ish'
Actual Output:
text'ti salnei ish'
Case 3
Input:
textis_equal(even_first_odd_reversed('1234567890'), '1357908642')
Expected Output:
text'1357908642'
Actual Output:
text'1357908642'
💻 IITM Official Solution
pythondef even_first_odd_reversed(s: str) -> str: '''Return a string with the characters in the even indices first and the characters in the odd indices reversed next. Arguments: s: str - the input string Return: str - modified string Example: >>> even_first_odd_reversed('abcde') 'acedb' >>> even_first_odd_reversed('python') 'ptonhy' ''' return s[::2]+s[1::2][::-1]
💻 My Submitted Code
pythondef even_first_odd_reversed(s: str) -> str: '''Return a string with the characters in the even indices first and the characters in the odd indices reversed next. Arguments: s: str - the input string Return: str - modified string Example: >>> even_first_odd_reversed('abcde') 'acedb' >>> even_first_odd_reversed('python') 'ptonhy' ''' ... even_chars = s[0::2] odd_chars = s[1::2] odd_reversed = odd_chars[::-1] return even_chars + odd_reversed