Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
26 lines (19 loc) · 461 Bytes

File metadata and controls

26 lines (19 loc) · 461 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# -*- coding:utf-8 -*-
__author__ = 'gjw'
__time__ = '2018/1/8 0008 下午 3:05'
# 题目:利用递归函数调用方式,将所输入的5个字符,以相反顺序打印出来。
def output(s, l):
if l == 0:
return
else:
print(s[l-1])
output(s, l-1)
s = input("输入字符串")
l = len(s)
output(s, l)
# 不是用递归
print("不使用递归")
li = list(s)
li.reverse()
for i in range(0, len(li)):
print(li[i])
Morty Proxy This is a proxified and sanitized view of the page, visit original site.