Skip to content

Commit 47a9ea2

Browse files
authoredAug 19, 2019
Simplify code by dropping support for legacy Python (#1143)
* Simplify code by dropping support for legacy Python * sort() --> sorted()
1 parent 32aa7ff commit 47a9ea2

File tree

145 files changed

+367
-976
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+367
-976
lines changed
 

‎CONTRIBUTING.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ We want your work to be readable by others; therefore, we encourage you to note
5656

5757
```python
5858
"""
59-
This function sums a and b
59+
This function sums a and b
6060
"""
6161
def sum(a, b):
6262
return a + b
@@ -82,13 +82,13 @@ We want your work to be readable by others; therefore, we encourage you to note
8282
The following "testing" approaches are **not** encouraged:
8383

8484
```python
85-
input('Enter your input:')
85+
input('Enter your input:')
8686
# Or even worse...
87-
input = eval(raw_input("Enter your input: "))
87+
input = eval(input("Enter your input: "))
8888
```
89-
89+
9090
However, if your code uses __input()__ then we encourage you to gracefully deal with leading and trailing whitespace in user input by adding __.strip()__ to the end as in:
91-
91+
9292
```python
9393
starting_value = int(input("Please enter a starting value: ").strip())
9494
```
@@ -99,13 +99,13 @@ We want your work to be readable by others; therefore, we encourage you to note
9999
def sumab(a, b):
100100
return a + b
101101
# Write tests this way:
102-
print(sumab(1,2)) # 1+2 = 3
103-
print(sumab(6,4)) # 6+4 = 10
102+
print(sumab(1, 2)) # 1+2 = 3
103+
print(sumab(6, 4)) # 6+4 = 10
104104
# Or this way:
105-
print("1 + 2 = ", sumab(1,2)) # 1+2 = 3
106-
print("6 + 4 = ", sumab(6,4)) # 6+4 = 10
105+
print("1 + 2 = ", sumab(1, 2)) # 1+2 = 3
106+
print("6 + 4 = ", sumab(6, 4)) # 6+4 = 10
107107
```
108-
108+
109109
Better yet, if you know how to write [__doctests__](https://docs.python.org/3/library/doctest.html), please consider adding them.
110110

111111
- Avoid importing external libraries for basic algorithms. Only use those libraries for complicated algorithms.

‎ciphers/affine_cipher.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import print_function
21
import sys, random, cryptomath_module as cryptoMath
32

43
SYMBOLS = r""" !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"""

0 commit comments

Comments
 (0)
Please sign in to comment.