Style Guide (PEP-8)
- Google’s python style guide is also used by many organizations Refer Here
- Lets focus on comments and Docstrings
Comments and Docstrings
- Refer Here for specific section of comments and doc string
- To enable google docstrings in visual studio code lets install an extenstion autodocstring


- Use this extension to generate docstrings
Operators (contd..)
- Refer Here for operators docs
-
Assignment operators
- Comparision Operators

-
Logical Operators
- Refer Here for notebook
Spacing in python
- In python we would come across lines and blocks (sequence of lines), python has a very strict spacing rule
Useful Functions
- input
input
conditional statements in python
- Refer Here for docs
- Conditionals
- if
- if else
- if elif else
- nested if statmements
- syntax
if <conditional expression> :
<block>
- Hacker Rank Problem
Task
Given an integer, , perform the following conditional actions:
If is odd, print Weird
If is even and in the inclusive range of to , print Not Weird
If is even and in the inclusive range of to , print Weird
If is even and greater than , print Not Weird
Input Format
A single line containing a positive integer, .
Constraints
Output Format
Print Weird if the number is weird. Otherwise, print Not Weird.
- Refer Here for solution
Looping statements in python
- While Refer Here
while <conditional expression>:
block
- Refer Here for the some of the problems solved in the class.
