Project euler 9
- Brute force: Check all the possibilities
General sites/books to research about python
- First preference Real Python
- I would suggest
- Programiz
- Geek for Geeks
- W3schools
- Books:
- Think Python
- Python in a nutshell
- Head First Python
- Learn Python
Python
- Python is a dynamically typed language i.e. you need not specify types while writing code
- Each line is a statement in python
- Lets checkout REPL (Read evaluate Print loop) provided as part of python installation. Open terminal and type python

- Easier way to find types in python is using a special function
type() - Zen of Python Refer Here
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
-
Indentation: Refer Here
-
Style Guide: Refer Here
- Naming Guide:
- variables: Python follows snake casing
-
Add comments to increse readability, But it is recommended to us doc strings
-
Datatypes in python:
- Refer Here for data types
- Numeric
- String
- Boolean
- Sequence
- Mapping
- Set
- Operators in Python
- Flow Control
- conditional statements
- loops for while
Project euler problem 1
- Problem statement
- steps
result = 0
limit = 10
index = 1
until index < limit do the following
if (index % 3 == 0) or (index % 5 == 0) then
result = index + result
end
index = index + 1
end
