mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
Simplify code by dropping support for legacy Python (#1143)
* Simplify code by dropping support for legacy Python * sort() --> sorted()
This commit is contained in:
@@ -8,9 +8,6 @@ method 2:
|
||||
"Simpson Rule"
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
def method_2(boundary, steps):
|
||||
# "Simpson Rule"
|
||||
# int(f) = delta_x/2 * (b-a)/3*(f1 + 4f2 + 2f_3 + ... + fn)
|
||||
|
||||
@@ -7,8 +7,6 @@ method 1:
|
||||
"extended trapezoidal rule"
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
def method_1(boundary, steps):
|
||||
# "extended trapezoidal rule"
|
||||
# int(f) = dx/2 * (f1 + 2f2 + ... + fn)
|
||||
@@ -19,7 +17,7 @@ def method_1(boundary, steps):
|
||||
y = 0.0
|
||||
y += (h/2.0)*f(a)
|
||||
for i in x_i:
|
||||
#print(i)
|
||||
#print(i)
|
||||
y += h*f(i)
|
||||
y += (h/2.0)*f(b)
|
||||
return y
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from __future__ import annotations
|
||||
import datetime
|
||||
import argparse
|
||||
|
||||
@@ -7,7 +6,7 @@ def zeller(date_input: str) -> str:
|
||||
|
||||
"""
|
||||
Zellers Congruence Algorithm
|
||||
Find the day of the week for nearly any Gregorian or Julian calendar date
|
||||
Find the day of the week for nearly any Gregorian or Julian calendar date
|
||||
|
||||
>>> zeller('01-31-2010')
|
||||
'Your date 01-31-2010, is a Sunday!'
|
||||
@@ -108,7 +107,7 @@ def zeller(date_input: str) -> str:
|
||||
# Validate
|
||||
if not 0 < d < 32:
|
||||
raise ValueError("Date must be between 1 - 31")
|
||||
|
||||
|
||||
# Get second seperator
|
||||
sep_2: str = date_input[5]
|
||||
# Validate
|
||||
|
||||
Reference in New Issue
Block a user