华为机考入门python3--(11)牛客11-数字颠倒

分类:字符串

知识点:

  1. int转字符串 str = int(num)

  2. 对字符串进行逆序 my_str = str[::-1]

题目来自【牛客】

python 复制代码
def reverse_integer(n):  
    # 将整数转换为字符串  
    str_n = str(n)  
    # 使用[::-1]来反转字符串  
    reversed_str = str_n[::-1]  
    return reversed_str  
  

input_str = input().strip()
print(reverse_integer(input_str))

by 软件工程小施同学

相关推荐
渡过晚枫18 小时前
[第十六届蓝桥杯/java/算法]1.偏蓝
java·算法·蓝桥杯
2501_9403152618 小时前
【无标题】1302 层数最深叶子节点的和
java·数据结构·算法
invincible_Tang18 小时前
AcWing 796. 子矩阵的和 _
数据结构·算法
米粒118 小时前
力扣算法刷题 Day 8
算法·leetcode·职场和发展
Sakinol#18 小时前
Leetcode Hot 100 —— 普通数组
算法·leetcode
@Mike@18 小时前
【算法】高精度
算法
leo__52018 小时前
MHT多假设跟踪算法(Multiple Hypothesis Tracking)MATLAB实现
开发语言·算法·matlab
ShineWinsu18 小时前
对于C++中unordered_set的详细介绍
数据结构·c++·算法·面试·stl·哈希表·unordered_set
吃着火锅x唱着歌18 小时前
LeetCode 456.132模式
数据结构·算法·leetcode
二木九森18 小时前
LeetCode-寻找环形链表的入口
算法·leetcode·链表