Registry Synced

Jan 2026 - Python - Week 6 - Strings 3 - Graded

470 words
2 min read

Graded Assignment

Course: Jan 2026 - Python
Strings 3 - 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:27 PM IST
Private Tests
3/3 Passed
Submitted on Mar 25, 2026 at 2:27 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.


Palindrome Integer**
Given an integer, check whether it is a palindrome. A palindrome is a number or a string that reads the same backward as forward.
Assume the numbers are positive.
Example
python
is_palindrome(121) == True
is_palindrome(123) == False
is_palindrome(1212) == False
Template Code(Click to Expand)

def is_palindrome(n: int) -> bool:
    '''Checks if an integer is a palindrome.

    Arguments:
    n: int - the integer to check

    Return:
    bool - True if the integer is a palindrome, False otherwise
    '''
    ...

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:
text
is_equal(is_palindrome(121), True)
Expected Output:
text
True
Actual Output:
text
True

Case 2

Input:
text
is_equal(is_palindrome(123), False)
Expected Output:
text
False
Actual Output:
text
False

Case 3

Input:
text
is_equal(is_palindrome(-121), False)

Private Tests ( 3/3 )

Case 1

Input:
text
is_equal(is_palindrome(0), True)
is_equal(is_palindrome(9), True)
Expected Output:
text
True

True
Actual Output:
text
True

True

Case 2

Input:
text
is_equal(is_palindrome(1001), True)
is_equal(is_palindrome(12321), True)
is_equal(is_palindrome(12345), False)
Expected Output:
text
True

True

False
Actual Output:
text
True

True

False

Case 3

Input:
text
is_equal(is_palindrome(123456), False)
is_equal(is_palindrome(1232123), False)
is_equal(is_palindrome(78900987), True)
Expected Output:
text
False

False

True
Actual Output:
text
False

False

True

💻 IITM Official Solution

python

def is_palindrome(n: int) -> bool:
    '''Checks if an integer is a palindrome.

    Arguments:
    n: int - the integer to check

    Return:
    bool - True if the integer is a palindrome, False otherwise
    '''


    return str(n) == str(n)[::-1]


💻 My Submitted Code

python

def is_palindrome(n: int) -> bool:
    '''Checks if an integer is a palindrome.

    Arguments:
    n: int - the integer to check

    Return:
    bool - True if the integer is a palindrome, False otherwise
    '''
    ...

    if n < 0:
        return False

    s=str(n)

    return s == s[::-1]

Document Outline
Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.