其他分享
首页 > 其他分享> > lowercase_to_uppercase

lowercase_to_uppercase

作者:互联网

python 

char to int: ord(character)

int to char: chr(int_num)

 

Convert a lowercase character to uppercase.

Example 1:

Input: 'a'
Output: 'A'

Example 2:

Input: 'b'
Output: 'B'

 

class Solution:
    """
    @param character: a character
    @return: a character
    """
    def lowercase_to_uppercase(self, character):
        # write your code here
       diff = ord("A") - ord("a")
       return chr(ord(character) + diff)

 

标签:lowercase,int,uppercase,character,char,ord
来源: https://www.cnblogs.com/zijidan/p/16255696.html