day2 python 学习笔记

本文介绍了Python中math模块的基本使用方法,包括常见的数学运算函数。此外还详细讲解了字符串处理技巧,如删除指定字符及如何通过索引操作字符串。并通过实例展示了条件语句的应用,以及如何使用enumerate()函数进行索引映射。

from math import*:
   math 模块函数: https://blog.youkuaiyun.com/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.youkuaiyun.com/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]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值