Python小代碼_9_求水仙花數
for i in range(100, 1000): ge = i % 10 shi = i // 10 % 10 bai = i // 100 if ge ** 3 + shi ** 3 + bai ** 3 == i: print(i, end=‘ ‘) #輸出結果 #153 370 371 407
Python小代碼_9_求水仙花數
相關推薦
Python小代碼_9_求水仙花數
pos == body post end for print color 代碼 for i in range(100, 1000): ge = i % 10 shi = i // 10 % 10 bai = i // 100 if ge *
最近開始努力學python 寫了一個python小代碼:判斷一個登陸程序,如果賬號密碼輸錯3次,鎖定賬號無法再登陸
登陸 readlines 輸入 連續 nbsp 努力 一個 取數據 lis 1 count = 0 2 username = ‘zhangsan‘ 3 userpassword = ‘111111‘ 4 5 f = open(‘lock.txt‘,‘r+‘
Python小代碼_3_購物車
bubuko one ppi sorry while avi color wan app product_list = [ (‘MacBook‘, 9000), (‘kindle‘, 500), (‘tesla‘, 900000), (‘b
Python小代碼_10_判斷是否為素數
clas pri post integer class log 代碼 輸出結果 col import math n = int(input(‘Input an integer:‘)) m = int(math.sqrt(n) + 1) for i in range(2,
Python小代碼_11_生成小於 n 的裴波那契數列
spa nbsp body color 代碼 pre end gpo col def fib(n): a, b = 1, 1 while a < n: print(a, end=‘ ‘) a, b = b, a + b
Python小代碼_12_生成前 n 行楊輝三角
spa lin log range color pri append body 小代碼 def demo(t): print([1]) print([1, 1]) line = [1, 1] for i in range(2, t):
在 Python代碼中操作mysql數據
let pre pda name mysq div pos print count # 創建Connection連接 conn = connect(host=‘localhost‘, port=3306, user=‘root‘, password=‘mysql‘, dat
Python簡單的購物車小代碼
-- 代碼 編號 IV git app pin HA AS 1 # -*- coding: utf-8 -*- 2 # @Time : 2018-05-31 14:56 3 # @Author : 超人 4 # @Email : huxiaojiu11
python 代碼題06 回數是指從左向右讀和從右向左讀都是一樣的數,例如12321,909。請利用filter()篩選出回數
list turn 例如 lte else 代碼 rom 都是 python def is_palindrome(n): return str(n) == str(n)[::-1] output = filter(is_palindrome, range(1, 10
小程式求水仙花數
題目:打印出所有的 "水仙花數 ",所謂 "水仙花數 "是指一個三位數,其各位數字立方和等於該數本身。例如:153是一個 "水仙花數 ",因為 153=1*1*1+5*5*5+3*3*3。 程式碼: public clas
Python練習題5(求水仙花數):編寫一個程式,求 100~999 之間的所有水仙花數 (如果一個 3 位數等於其各位數字的立方和,則稱這個數為水仙花數)
方法一:使用int和str,將int轉成字串拼接後再轉成int。 1 for i in range(1,10): 2 for j in range(0,10): 3 for k in range(0,10): 4 num = int(str(i) + s
Android版微信小代碼(轉)
一個 get 登錄 switch racer 指點 然而 系統 sha 以下代碼僅適用於Android版微信; //switchtabpos:讓微信tab更貼合Android Design 如果你並不喜歡微信Android版和iOS端同用一套UI,現在有一個小方法可以實現T
購物車小代碼
dig log quit python pre append lar lan num goods = ["iphone6s","mac_book","coffee","python_book","bicyle"] price = [5800,9000,32,80,1500
靜態的代碼與構造函數
ram ati () spa style generate div out 入口 public class ccc { public ccc() { System.out.println("ccc"); } /**
eImage(僅兩行代碼實現輸出從數據庫中查詢到的二進制字段)標簽
article use cor == target rom ont lec -s 功能: 專門用於向瀏覽器輸出從數據庫中查詢到的二進制字段。支持通用的幾十種文件類型 別名為edoc 使用方法: <chtml><eimage id=書包名
java代碼導入excel數據至oracle
java excel本文處理的excel格式為xlsx: 1.新建maven項目 <dependencies> <dependency> <groupId>org.apache.poi</groupId&
python基礎代碼
scores ted append class tuples code xtend indices odi 1 from heapq import *; 2 from collections import *; 3 import random as rd;
dojo小代碼
use enc tro ffffff src lin img example his RunSource Using event delegation on an HTML table to highlight rows and columns. ------------
java代碼實現highchart與數據庫數據結合完整案例分析(一)---餅狀圖
隱藏 des log cred 數據庫數據 idt string 時間 input 作者原創:轉載請註明出處 在做項目的過程中,經常會用到統計數據,同時會用到highchart或echart進行數據展示,highchart是外國開發的數據統計圖插件, echa
java代碼實現highchart與數據庫數據結合完整案例分析(二)---折線圖
end idt 。。 客戶端 屬性 hid pla 循環 scrip 作者原創:未經博主允許不許轉載 在上一篇的博客中,展示和分析了如何做一個餅狀圖,有疑問可以參考上一篇博客。 現在分析和展示折線圖的繪制和案例分析, 先展示效果圖: 與餅狀圖不同的是,折線圖展現更多的數據