当前位置:网站首页>String output
String output
2022-06-29 02:18:00 【Long street 395】
describe
The user enters a string , Output characters with even forward index sequence number in one line . Such as user input :“hello”, After the program runs, output “hlo”.
Input format
Enter a string
Output format
Output a string
Example 1
Input :hello
Output :hloThe first is to use C Language thinking :
n=input()
t=len(n)
p=''
for i in range(0,t):
if(i%2==0):
p=p+n[i]
print(p)
The second kind python The minimalist :
str = input()
print(str[::2])
#print(a[0:len(a):2]) It's fine too , Omit the start and end positions in the previous line of code , the last one 2 It's the step length 边栏推荐
猜你喜欢
![[redis] data introduction & General Command & string type](/img/86/3abc5047f9c0a051f432e82ccc816c.png)
[redis] data introduction & General Command & string type

Koa 快速入门

Zhongyi technology resumed the review status of the gem IPO, and xuxiaofei no longer acted as a practicing lawyer

【Redis】初识 Redis

SystemVerilog structure (I)

Boost the digital economy and face the future office | the launch of the new version of spreadjsv15.0 is about to begin

学习太极创客 — MQTT 第二章(九)本章测试
![[redis] list type](/img/c7/adec2aaea50d69a0aed95bfe683b9e.png)
[redis] list type
![[redis] set type](/img/97/0a83016e89316849c01072044f2124.png)
[redis] set type

【Redis】Set类型
随机推荐
字符串分段组合
Day10 enumeration class and annotation
【Redis】Hash类型
What is the dry goods microservice architecture? What are the advantages and disadvantages?
Which is the best billing method for okcc call center
110. simple chat room 13: chat room server
Scala 基礎 (三):運算符和流程控制
Troubleshooting of pyinstaller failed to pack pikepdf
How to become a senior digital IC Design Engineer (3-5) tools: Spyglass Technology
[network communication learning notes] socket IO setup and deployment
Chrome browser close update Popup
Why should the pointer be null after delete
Written examination questions, answers and analysis of Digital IC design and FPGA design (2) 2021 Huawei Hisilicon (Part 1)
计算矩形面积
Use code binding DataGridView control to display tables in program interface
芯片原厂必学技术(1)引言
OpenResty 使用介绍
Junior final exam
[redis] get to know redis for the first time
How does flush open an account? Is it safe to open an account online?