Write a function to reverse a string.
def reverse_string(input_str):
return input_str[::-1]
Example:
reverse_string('hello') # Output: 'olleh'
복습용 저장
복습용 저장
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
WithoutBook은 주제별 면접 질문, 온라인 연습 테스트, 튜토리얼, 비교 가이드를 하나의 반응형 학습 공간으로 제공합니다.
Know the top Python Coding interview questions and answers for freshers and experienced candidates to prepare for job interviews.
Know the top Python Coding interview questions and answers for freshers and experienced candidates to prepare for job interviews.
Search a question to view the answer.
def reverse_string(input_str):
return input_str[::-1]
Example:
reverse_string('hello') # Output: 'olleh'
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
def is_palindrome(input_str):
return input_str == input_str[::-1]
Example:
is_palindrome('radar') # Output: True
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
def is_leap_year(year):
return (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0)
Example:
is_leap_year(2024) # Output: True
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
def find_max_element(lst):
return max(lst)
Example:
find_max_element([3, 7, 2, 8, 5]) # Output: 8
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
from collections import Counter
def count_occurrences(lst):
return Counter(lst)
Example:
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
def is_anagram(str1, str2):
return sorted(str1) == sorted(str2)
Example:
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.
def remove_duplicates(lst):
return list(set(lst))
Example:
이 항목을 북마크하거나, 어렵게 표시하거나, 복습 세트에 넣을 수 있습니다.