2022 8 23

今天先练习了pandas库函数:
import numpy as np
import pandas as pd
cols = ["zombie","skeleton","steve"]
text = [pd.Series([1,2,3],name="damage",index=cols),
        pd.Series([10,20,15],index =cols,name = "health")]
df = pd.DataFrame(text)
print(df)

https://zhuanlan.zhihu.com/p/139052035

001 (单链表相关)https://www.lanqiao.cn/problems/1110/learning/

***需要复习

m = int(input())
class Node:
    def __init__(self,val,next=None):
        self.val=val
        self.next=next
first = Node(1)

def delete(node,val):
    dull = Node(0)
    dull.next=node
    pre=dull
    cur=node
    while cur:
        if cur.val==val:
            pre.next=cur.next
            break
        else:
            pre=cur
            cur=cur.next
    return dull.next
def show(node):
    while node:
        print(node.val,end=" ")
        node=node.next
        
            
cur = first
for i in range(2,11):
    temp=Node(i)
    cur.next=temp
    cur=temp
for i in range(m):
    temp = int(input())
    first = delete(first,temp)
    new = Node(temp)
    new.next=first
    first=new
    show(first)
    print()

 

 

 

002 https://www.lanqiao.cn/problems/539/learning/

n = int(input())
nums = set(map(int, input().split()))
nums = sorted(nums)
print(len(nums))
print(" ".join(map(str, nums)))

 

posted @ 2022-08-24 20:02  0MrMKG  阅读(22)  评论(0)    收藏  举报