File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -267,7 +267,8 @@ def replaceDigits(s: str) -> str:
267267# Output: "abcdef"
268268# print(replaceDigits(s))
269269
270-
271- a = [12 ,6 ,3 ]
272- b = map (str ,a )
273- print (list (b ))
270+ def startswith (w ):
271+ return w .startswith ("a" )
272+ li = ['apple' ,'orange' ,'pineapple' ,'grape' ]
273+ res = filter (startswith ,li )
274+ print (list (res ))
Original file line number Diff line number Diff line change 1+ from math import sqrt
2+ class So :
3+ '''
4+ So 的 Docstring
5+
6+ '''
7+ def countTriples (self , n : int ) -> int :
8+ '''
9+ 1925. Count Square Sum Triples
10+
11+ triple = a 二次方 + b 二次方 = c 二次方
12+
13+ :param self: 說明
14+ :param n: 數值n
15+ :type n: int
16+ :return: 說明
17+ :rtype: int
18+ '''
19+ ans = 0
20+ for a in range (1 ,n + 1 ):
21+ for b in range (1 ,n + 1 ):
22+ pairs = int (sqrt (a ** 2 + b ** 2 + 1 ))
23+ if pairs <= n and pairs ** 2 == a ** 2 + b ** 2 :
24+ ans += 1
25+ return ans
26+
27+ ans = So ()
28+ n = 5
29+ # 2
30+ print (ans .countTriples (n ))
You can’t perform that action at this time.
0 commit comments