day2 python 学习笔记

xiaoxiao2021-02-28  26

from math import*:    math 模块函数: https://blog.csdn.net/lijiahong2012/article/details/52416400 【次方】

n**digit : 2**2=4 【条件语句】

1. 注意缩进 2. if not isinstance (digit,n) 3.注意冒号

字符串中如果同时包含” 和 ‘ 可以用转义字符  'I\'m \"OK\"!'-------I'm "OK" ! ord('a')=97

【字符串】 删除: s.strip(a)------删左右

           s.rstrip(a)  s.lstrip(a)            s=s[:-1]   # 删除最后一个数

You're given strings J representing the types of stones that are jewels, and S representing the stones you have.  Each character in S is a type of stone you have.  You want to know how many of the stones you have are also jewels.

The letters in J are guaranteed distinct, and all characters in J and S are letters. Letters are case sensitive, so "a" is considered a different type of stone from "A"

【enumerate()】https://blog.csdn.net/churximi/article/details/51648388

Given two lists Aand B, and B is an anagram of A. B is an anagram of A means B is made by randomizing the order of the elements in A.

We want to find an index mapping P, from A to B. A mapping P[i] = j means the ith element in A appears in B at index j.

These lists A and B may contain duplicates. If there are multiple answers, output any of them.

For example, given

A = [12, 28, 46, 32, 50] B = [50, 12, 32, 46, 28]

We should return [1, 4, 3, 2, 0]
转载请注明原文地址: https://www.6miu.com/read-2631575.html

最新回复(0)