Problem
2899 => 2 + 8 + 9 + 9 => 28 => 2 + 8 => 10 => 1 + 0 => 1
7888 => 7 + 8 + 8 + 8 => 31 => 3 + 1 => 4
-
help her getting individual digits
-
Sara
Hi sara
number = 2899
result = 0
until number > 0
digit = number % 10
result = result + digit
number = number // 10
if number == 0 && result > 9
number = result
result = 0
say result
Programming
- We are programming at the user space

- Formal languages like C, C#, Java, Python etc help us in building applications/scripts by abstracting all the os level details
- We have 3 possible options in any formal languages
- Compiler: C, C++, Golang
- Interpreter: bash, python, Ruby
- Hybrid: Java, C#
-
When you run any application/program, OS start process. Each process will have unique id, memory and cpu shares allocated
-
To deal with memory, languages offer datatypes
- integers
- floats
- string
- boolean
- …
- Languages can be broadly classified into two types based on how they deal with datatypes
- Statically typed languages:
- We need to specify data type for variables
- example: C, C++, Java, C#
- dynamically typed languages
- no need to be explicit, interpreter decides the type based on value passed
- example: python, javascript, bash
- Python is interpreted & dynamically typed programming (formal) language.
- Zen of Python
- References:
- Pythons official docs
- Real Python
- Beginner friendly
- Programiz
- W3Schools
- Geek for Geeks
- Books:
- Think Python
- Introducing python
- Headsfirst python
- Prompt:
As an expert in python, I'm begineer in python trying to understand <topic>, Give me examples, usecases and where is it used