语法练习:non_start

这是一个关于Python编程的语法练习题,要求给定两个字符串,返回它们的拼接,但忽略每个字符串的第一个字符。提供的解答经过了一系列测试用例验证,所有测试均通过。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

语法练习:non_start

题目:non_start

Given 2 strings, return their concatenation, except omit the first char of each. The strings will be at least length 1.

non_start(‘Hello’, ‘There’) → ‘ellohere’
non_start(‘java’, ‘code’) → ‘avaode’
non_start(‘shotl’, ‘java’) → ‘hotlava’

我的解答:

def non_start(a, b):
  return a[1:] + b[1:]

Expected Run
non_start(‘Hello’, ‘There’) → ‘ellohere’ ‘ellohere’ OK
non_start(‘java’, ‘code’) → ‘avaode’ ‘avaode’ OK
non_start(‘shotl’, ‘java’) → ‘hotlava’ ‘hotlava’ OK
non_start(‘ab’, ‘xy’) → ‘by’ ‘by’ OK
non_start(‘ab’, ‘x’) → ‘b’ ‘b’ OK
non_start(‘x’, ‘ac’) → ‘c’ ‘c’ OK
non_start(‘a’, ‘x’) → ‘’ ‘’ OK
non_start(‘kit’, ‘kat’) → ‘itat’ ‘itat’ OK
non_start(‘mart’, ‘dart’) → ‘artart’ ‘artart’ OK
other tests
OK

All Correct

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值