Skip to content

Commit 113da34

Browse files
Update README and CodeFormat
1 parent 6ed7adc commit 113da34

File tree

2 files changed

+42
-11
lines changed

2 files changed

+42
-11
lines changed

CodeFormat.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#<link>
22

3+
from <module> import <module>
4+
35
class <data_struct>:
46
...
57

README.md

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,53 @@ Following project contains [Python3](https://docs.python.org/3/) implementation
44
### Format of the Programs :
55
```
66
1. # <link reffering to the respective GeeksforGeeks page>
7-
2. <Data Structures used, if any>
8-
3. <Function handling the computation>
7+
2. <from module import module | if any>
8+
3. <Data Structures used | if any>
9+
4. <Primary Function : handles the computation>
910
: return the desired result (whenever possible)
10-
4. <Helper functions, if any>
11-
5. # main
12-
6. if __name__=="__main__" :
13-
7. <inside main>
11+
5. <Helper functions | if any>
12+
6. # main
13+
7. if __name__=="__main__" :
14+
8. <inside main>
1415
: get input from the user
15-
: pre-processing of data, if required
16+
: pre-processing of data | if required
1617
: call the function
1718
: print the result
18-
8. Documentation for the code
19+
9. Documentation for the code
1920
: Input Explanation
2021
: Input <Example>
2122
: Output <Example>
22-
9. Documentation for the GeeksforGeeks page content
23+
10. Documentation for the GeeksforGeeks page content
2324
```
2425

25-
**Note** : this is not affiliated with GeeksforGeeks in any way other than for reference purpose.
26+
**Imp :** In the code, provide [Function Annotations](https://www.python.org/dev/peps/pep-3107/) as per [PEP 3107 -- Function Annotations](https://www.python.org/dev/peps/pep-3107/) **for every parameter passed in a function**. Return type specification is optional.
2627

27-
**Also Note** : the code implemetation (and sometimes even algorithm) might be different than the one in GeeksforGeeks. The decision is upon the author and author alone. New Algorithms for the same problem statement may be added in the future.
28+
Annotations for *parameters* take the form of optional expressions that follow the parameter name:
29+
30+
```python
31+
def foo(a: expression, b: expression = 5):
32+
...
33+
34+
#Ex :
35+
def foo(l: list, s: str = 'xyz'):
36+
...
37+
38+
#In pseudo-grammar, parameters now look like identifier [: expression] [= expression]
39+
```
40+
41+
Annotations for the type of a function's return value take the form of optional expressions that is done like so:
42+
43+
```python
44+
def sum() -> expression:
45+
...
46+
47+
#Ex :
48+
def sum() -> int:
49+
...
50+
51+
```
52+
53+
54+
##### **Note** : this is not affiliated with GeeksforGeeks in any way other than for reference purpose.
55+
56+
##### **Also Note** : the code implemetation (and sometimes even algorithm) might be different than the one in GeeksforGeeks. The decision is upon the author and author alone. New Algorithms for the same problem statement may be added in the future.

0 commit comments

Comments
 (0)