'''
@Author: your name
@Date: 2020-07-13 18:21:52
@LastEditTime: 2020-07-13 21:48:41
@LastEditors: Please set LastEditors
@Description: In User Settings Edit
@FilePath: \vscode_py\day8.py
'''
# Q22
# 读取终端输入的单词的数量,最后输出排序后的结果
def Q22():
dic={}
l=input().split()
# 法1,使用dict
# for i in l:
# dic[i]=dic.get(i,0)+1 # 获取key对应的value
# words=dic.keys() # dict_keys(['New', 'to', 'Python', 'or', 'choosing', 'between', '2', 'and', '3?', 'Read', '3.'])
# print(words)
# words=sorted(words) # ['2', '3.', '3?', 'New', 'Python', 'Read', 'and', 'between', 'choosing', 'or', 'to']
# print(words)
# # print(sortwords)
# for i in words:
# print("{}:{}".format(i,dic[i]))
# 法2,使用set
l_s=sorted(set(l)) # set 没有重复 得到一个[]
print("ls:{}".format(l_s))
for i in l_s:
print("{}:{}".format(i,l.count(i)))
# Q23
# 计算平方值 p**n=p^n
def Q23():
p=int(input())
print("p:{}".format(p))
print("{}^{}={}".format(p,2,p**2))
# Q 24
# 输出doc文件
def Q24():
'''
return p^n
'''
p=int(input())
print("p:{}".format(p))
print("{}^{}={}".format(p,2,p**2))
# Q 25
# 一个类,并实例化
class Car:
name="car"
def __init__(self,name=None):
=name
if __name__ == "__main__":
# Q22()
# Q23()
# Q24
# print(abs.__doc__)
# print(Q24.__doc__)
# Q25
car1=Car("Honda")
print("car1:{}".format())
car2=Car()
="Toyota"
print("car2:{}".format())