forked from MIT-Emerging-Talent/ET6-practice-code-review
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggested Python Coding Challenges: Easy and Medium Levels #36
Labels
challenge
a new challenge
Discussion
For conversations or brainstorming sessions about team processes or project direction
Comments
malakbattat
added
challenge
a new challenge
Discussion
For conversations or brainstorming sessions about team processes or project direction
labels
Jan 5, 2025
malakbattat
changed the title
Python Coding Challenges Suggestions: Easy, and Medium
Suggested Python Coding Challenges: Easy and Medium Levels
Jan 5, 2025
malakbattat
added
challenge
a new challenge
and removed
challenge
a new challenge
labels
Jan 5, 2025
github-project-automation
bot
moved this from TODO
to READY FOR REVIEW
in ET6 Foundations Group 17
Jan 6, 2025
Thank you Malak for sharing such useful suggestions |
Wow this is amazing, malak!!! |
Thanks Malak, for sharing your suggestions, they are well explained. great work! |
Thank you Malak, for your suggestions and your time. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
challenge
a new challenge
Discussion
For conversations or brainstorming sessions about team processes or project direction
Python Coding Challenges: Easy, and Medium Problems
Easy Challenges
1. Palindrome Check
Problem: Write a function that checks if a given string is a palindrome (reads the same forward and backward).
def is_palindrome(s: str) -> bool:
is_palindrome("racecar")
should returnTrue
is_palindrome("hello")
should returnFalse
2. Sum of Digits
Problem: Write a function that calculates the sum of digits of a given integer.
def sum_of_digits(n: int) -> int:
sum_of_digits(1234)
should return10
sum_of_digits(987)
should return24
3. Temperature Converter
Problem: Write a function to convert temperature from Celsius to Fahrenheit and vice versa.
def convert_temperature(value: float, unit: str) -> float:
convert_temperature(100, 'C')
should return212.0
(Celsius to Fahrenheit)convert_temperature(32, 'F')
should return0.0
(Fahrenheit to Celsius)Medium Challenges
4. Prime Number Check
Problem: Write a function that checks if a number is prime.
def is_prime(n: int) -> bool:
is_prime(7)
should returnTrue
is_prime(10)
should returnFalse
5. Leap Year Checker
Problem: Write a function to check if a year is a leap year.
def is_leap_year(year: int) -> bool:
is_leap_year(2020)
should returnTrue
is_leap_year(2023)
should returnFalse
6. String Compression
Problem: Write a function that compresses a string using the counts of repeated characters. For example, "aaabbbcc" becomes "a3b3c2". If the compressed string is not shorter than the original string, return the original string.
def compress_string(s: str) -> str:
compress_string("aaabbbcc")
should return"a3b3c2"
compress_string("abc")
should return"abc"
The text was updated successfully, but these errors were encountered: