Skip to content

Commit

Permalink
Merge branch 'main' of github.com:MIT-Emerging-Talent/ET6-foundations…
Browse files Browse the repository at this point in the history
…-group-22
  • Loading branch information
TibyanKhalid committed Jan 12, 2025
2 parents 5821c25 + cf198b4 commit 61cd207
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions solutions/convert_to_uppercase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# !/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
A module that converts all letters to uppercase
Created on 31 12 2024
@author: Kareiman Altayeb
"""


def convert_to_uppercase(user_text: str) -> str:
"""Asks the user to enter a text and returns the text in capital
with all characters in uppercase
Parameters:
user_text (str): The user input text to be converted to uppercase.
Returns:
str : user_text in upper case
Raises:
AssertionError: If the input is empty or contains only spaces.
Examples:
>>> convert_to_uppercase('hello')
'HELLO'
>>> convert_to_uppercase('HelLo')
'HELLO'
>>> convert_to_uppercase('123hello')
'123HELLO'
"""

user_text = user_text.strip()

if not user_text:
raise AssertionError("Entry cannot be empty or just spaces")

return user_text.upper()

0 comments on commit 61cd207

Please sign in to comment.