日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python数据处理不用编程_用Python玩转数据数据处理相关小例编程题

發布時間:2025/1/21 python 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python数据处理不用编程_用Python玩转数据数据处理相关小例编程题 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

描述

有5名某界大佬xiaoyun、xiaohong、xiaoteng、xiaoyi和xiaoyang,其QQ號分別是88888、5555555、11111、1234321和1212121,用字典將這些數據組織起來。編程實現以下兩個功能:

(1)用戶輸入某一個大佬的姓名后可以輸出其QQ號,如果輸入的姓名不在字典中則返回提示信息并允許再次輸入;

(2)尋找所有有QQ靚號(5位數或小于5位數)的大佬,輸出所有姓名。

其中Python 2中提示輸入和輸出結果的兩句提示語請使用如下形式:

name = raw_input(“Please input the name:”)

print “Who has the nice QQ number?”

其中Python 3中提示輸入和輸出結果的兩句提示語請使用如下形式:

name = input(“Please input the name:”)

print(“Who has the nice QQ number?”)

code

a = dict(xiaoyun = '88888', xiaohong = '5555555', xiaoteng = '11111', xiaoyi = '1234321', xiaoyang = '1212121')

def findDalao(dicta, b = 'y'):

while b == 'y':

name = raw_input("Please input the name:")

while name not in dicta:

name = raw_input("invalid key,pls enter again:")

print('The QQ of %s is %s'% (name, dicta[name]))

b = raw_input('text y if you wanna continue:')

else:

print('find dalao qq ends')

def findNiceQQ(x):

print('Who has the nice number:')

for y in x.keys():

if len(x[y]) <= 5:

print(y)

findDalao(a)

findNiceQQ(a)

result

Please input the name:xiaoha

invalid key,pls enter again:xiaocheng

invalid key,pls enter again:xiaoteng

The QQ of xiaoteng is 11111

text y if you wanna continue:y

Please input the name:xiaoyun

The QQ of xiaoyun is 88888

text y if you wanna continue:n

find dalao qq ends

Who has the nice number:

xiaoyun

xiaoteng

總結

以上是生活随笔為你收集整理的python数据处理不用编程_用Python玩转数据数据处理相关小例编程题的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。