# CodeWars-1126

``# -*- coding: utf-8 -*-# @Time : 2017/11/26 上午11:59# @Author : SkullFang# @Email : [email protected]# @File : 11-26.py# @Software: PyCharmimport mathdef remove_char(s): if len(s)>2 : return s[1:-1] else: return '' #your code here"""def remove_char(s): return '' if len(s) <= 2 else s[1:-1]"""def find_next_square(sq): num=int(math.sqrt(sq)) if num**2 == sq: return (num+1)**2 # Return the next square if sq is a square, -1 otherwise return -1# print(find_next_square(121))"""bestdef find_next_square(sq): root = sq ** 0.5 if root.is_integer(): #判断是不是一个整数 return (root + 1)**2 return -1"""def divisors(integer): li=[i for i in range(2,integer) if integer%i==0] if li: return li return '{0} is prime'.format(integer) pass# print(divisors(13))"""best is me"""def make_negative( number ): return number if number<=0 else 0-number# print(make_negative(0))"""best is me"""def duplicate_count(text): text=text.lower(); li=[] cn=0; for i in range(0,len(text)): subli=text[i+1:] if text[i] in subli: if text[i] not in li: li.append(text[i]) cn+=1 return cn # Your code goes here# print(duplicate_count("aA11"))"""bestdef duplicate_count(s): return len([c for c in set(s.lower()) if s.lower().count(c)>1])"""def high_and_low(numbers): li=numbers.split(" ") re=[int(i) for i in li] max_number=max(re) min_number=min(re) numbers=str(max_number)+" "+str(min_number) return numbers# print(high_and_low("4 5 29 54 4 0 -214 542 -64 1 -3 6 -6"))""""""def unique_in_order(iterable): li=list(iterable) re=[] if li: re.append(li[0]) for i in range(1,len(li)): if li[i]!=li[i-1]: re.append(li[i]) return re# print(unique_in_order('A'))def reverse_seq(n): return list(reversed([i for i in range(1,n+1)])) pass# print(reverse_seq(5))def no_space(x): li=x.split(" ") re=[_ for _ in li if _ !=''] # print(re) return ''.join(re) #your code hereprint(no_space('8 j 8 mBliB8g imjB8B8 jl B'))``

1、判断一个数是不是整数可以用 is_interger()方法。
2、把列表转换为字符串可以用 ‘’.join(list)
3、字符串的分割用string.split(” “)