[LeetCode] 709. To Lower Case_Easy
2024-10-16 23:24:43
Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase.
Example 1:
Input: "Hello"
Output: "hello"
Example 2:
Input: "here"
Output: "here"
Example 3:
Input: "LOVELY"
Output: "lovely" Code
class Solution:
def toLower(self, s):
ans = ""
for c in s:
if ord('A') <= ord(c) <= ord('Z'):
ans += chr(ord('a') + ord(c) - ord('A'))
else:
ans += c
return ans
最新文章
- ETL数据从sqlserver到mysql之间迁移
- (原创)RS232串口信号定义
- android 开发之 百度地图的使用
- ASP.NET MVC中从后台控制器(Controller)传递数据到前台页面视图(View)方式
- 基于CoreText的基础排版引擎
- yii uploadfile 错误提示: fileinfo php extension is not installed
- 用SQL语句操作数据库
- http协议Authorization认证方式在Android开发中的使用
- osip及eXosip的编译方法
- DotNet程序汉化过程--SnippetCompiler简单解说
- Python -- 文档测试
- AngularJS中的$http.post与jQuery.post的区别
- 大数据学习系列之一 ----- Hadoop环境搭建(单机)
- 解决mariadb grant ERROR 1045 (28000): Access denied for user
- 分享:纯 css 瀑布流 和 js 瀑布流
- Pytorch 资料汇总(持续更新)
- linux Vue+nginx+django 实现前后端分离
- Tomcat的相关配置问题
- destoon源码解读
- ListView的另一种可读性更强的ViewHolder模式写法