本文目錄一覽:
- 1、python能做什麼有趣的東西
- 2、數獨人造解法的一些技巧及其python實現怎麼解決
- 3、python可以做哪些有趣的事情
- 4、用Python判斷數獨是否正確
- 5、怎麼用python解數獨的演算法題,給個矩陣裡面填充了若干數,用程序自動給填充完整
python能做什麼有趣的東西
python能做什麼有趣的東西?下面給大家介紹35個Python實例:
1. Python3 實現圖片識別
2. Python3 圖片隱寫術
3. 200 行 Python 代碼實現 2048
4. Python實現3D建模工具
5. 使用 Python 定製詞雲
相關推薦:《Python教程》
6. Python3 智能裁切圖片
7.微信變為聊天機器人
8. 使用 Python 解數學方程
9. 使用 Python 創建照片馬賽克
10. Python 基於共現提取《釜山行》人物關係
11. Python 氣象數據分析:《Python 數據分析實戰》
12. NBA常規賽結果預測:利用Python進行比賽數據分析
13. Python 的循環語句和隱含波動率的計算
14. K-近鄰演算法實現手寫數字識別系統
15. 數獨遊戲的 Python 實現與破解
16. 基於 Flask 與 MySQL 實現番劇推薦系
17. Python 實現英文新聞摘要自動提取
18. Python 解決哲學家就餐問題
19. Ebay 在線拍賣數據分析
20. 神經網路實現人臉識別任務
21. 使用 Python 解數學方程
22. Python3 實現火車票查詢工具
23. Python 實現埠掃描器
24. Python3 實現可控制肉雞的反向Shell
25. Python 實現 FTP 弱口令掃描器
26. 基於PyQt5 實現地圖中定位相片拍攝位置
27. Python實現網站模擬登陸
28.Python實現簡易區域網視頻聊天工具
29. 基於 TCP 的 python 聊天程序
30. Python3基於Scapy實現DDos
31. 高德API + Python 解決租房問題
32. 基於 Flask 與 RethinkDB 實現TODO List
33. Python3 實現簡單的 Web 伺服器
34. Python 實現 Redis 非同步客戶端
35. 仿 StackOverflow 開發在線問答系統
數獨人造解法的一些技巧及其python實現怎麼解決
總共有十幾種解題技巧,其中最直接的是顯式唯一數法和隱式唯一數法。所謂顯式唯一數法,是指某個格只有一個候選數可選,這個格自然就只能填這個候選數了。
而隱式唯一數法的意思則是,某一行、列或宮只有一個位置可以填某個候選數,當然,這個位置肯定就填這個候選數了。
python可以做哪些有趣的事情
1. Python3 實現色情圖片識別
2. Python3 圖片隱寫術
3. 200 行 Python 代碼實現 2048
4. Python實現3D建模工具
5. 使用 Python 定製詞雲
6. Python3 智能裁切圖片
7.微信變為聊天機器人
8. 使用 Python 解數學方程
9. 使用 Python 創建照片馬賽克
10. Python 基於共現提取《釜山行》人物關係
11. Python 氣象數據分析:《Python 數據分析實戰》
12. NBA常規賽結果預測:利用Python進行比賽數據分析
13. Python 的循環語句和隱含波動率的計算
14. K-近鄰演算法實現手寫數字識別系統
15. 數獨遊戲的 Python 實現與破解
16. 基於 Flask 與 MySQL 實現番劇推薦系
17. Python 實現英文新聞摘要自動提取
18. Python 解決哲學家就餐問題
19. Ebay 在線拍賣數據分析
20. 神經網路實現人臉識別任務
21. 使用 Python 解數學方程
22. Python3 實現火車票查詢工具
23. Python 實現埠掃描器
24. Python3 實現可控制肉雞的反向Shell
25. Python 實現 FTP 弱口令掃描器
26. 基於PyQt5 實現地圖中定位相片拍攝位置
27. Python實現網站模擬登陸
28.Python實現簡易區域網視頻聊天工具
29. 基於 TCP 的 python 聊天程序
30. Python3基於Scapy實現DDos
31. 高德API + Python 解決租房問題
32. 基於 Flask 與 RethinkDB 實現TODO List
用Python判斷數獨是否正確
#coding=utf-8
num_list=[
[5, 3, 4, 6, 7, 8, 9, 1, 2],
[6, 7, 2, 1, 9, 5, 3, 4, 8],
[1, 9, 8, 3, 4, 2, 5, 6, 7],
[8, 5, 9, 7, 6, 1, 4, 2, 3],
[4, 2, 6, 8, 5, 3, 7, 9, 1],
[7, 1, 3, 9, 2, 4, 8, 5, 6],
[9, 6, 1, 5, 3, 7, 2, 8, 4],
[2, 8, 7, 4, 1, 9, 6, 3, 5],
[3, 4, 5, 2, 8, 6, 1, 7, 9]
]
tmp = [1,2,3,4,5,6,7,8,9]
def check_shudu(num_list):
#
if len(num_list)9:
return -1
#
for j in num_list:
if sorted(j)tmp:
return -1
#
for i in range(9):
if sorted([j[i] for j in num_list])tmp:
return -1
#
for n in range(3):
for k in range(3):
jiu = []
for i in range(n*3,n*3+3):
for j in range(k*3,k*3+3):
jiu.append(num_list[i][j])
if sorted(jiu)tmp:
return -1
return 1
print check_shudu(num_list)
怎麼用python解數獨的演算法題,給個矩陣裡面填充了若干數,用程序自動給填充完整
class Solution:
# @param board, a 9×9 2D array
# Solve the Sudoku by modifying the input board in-place.
# Do not return any value.
def solveSudoku(self, board):
self.board = board
self.solve()
def findUnassigned(self):
for row in range(9):
for col in range(9):
if self.board[row][col] == “.”:
return row, col
return -1, -1
def solve(self):
row, col = self.findUnassigned()
#no unassigned position is found, puzzle solved
if row == -1 and col == -1:
return True
for num in [“1″,”2″,”3″,”4″,”5″,”6″,”7″,”8″,”9”]:
if self.isSafe(row, col, num):
self.board[row][col] = num
if self.solve():
return True
self.board[row][col] = “.”
return False
def isSafe(self, row, col, ch):
boxrow = row – row%3
boxcol = col – col%3
if self.checkrow(row,ch) and self.checkcol(col,ch) and self.checksquare(boxrow, boxcol, ch):
return True
return False
def checkrow(self, row, ch):
for col in range(9):
if self.board[row][col] == ch:
return False
return True
def checkcol(self, col, ch):
for row in range(9):
if self.board[row][col] == ch:
return False
return True
def checksquare(self, row, col, ch):
for r in range(row, row+3):
for c in range(col, col+3):
if self.board[r][c] == ch:
return False
return True
原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/304438.html