Scripting vs Programming
- Scripting
- We directly execute code and code is interpreted line by line
- We use scripting to automate or build small utilities
- Programming
- Program needs to be compiled.
- We tend to solve problems/build applications
Scripting/Programming Basics Contd
- Execution of script/program happens line by line
- Consider the following problem
- user gives you url as input, you need to print the domain name
- user should be shown error if the input is not in https or http url format
- Solution:
- Remember input provided as url
url = 'https://qt.com/test'
- is url in the http url format and remember as result
- print domain if result is true
- enter the url in the right format if the result is false
- THis script will have two possibities in its execution
- Generally the above way is referred as conditional execution.
- Consider the following problem
- user enters number and you need to print all the numbers below that number till 0
- Solution:
- Remember input provide as number
- Start from index = 0
- print index
- add 1 to the index
- check if it is less than number and remeber as result
- if result is true
- go to step 3
- else stop
- The above approach is called as looping constructs
Character Introduction
- ELSA

- What she knows ?
- Rememebering values
+ - * / %
=
<=, >=, ==
- You can instruct her what has to be done in steps and she can do it faster and also repeat this multiple times.
Instruction Manual with ELSA
- Examples 1: Calculate GST (7%)
1. Remember input provided as price
2. calculate price * 7 / 100 and remember as gst
3. say gst
- Examples 2: Calculate electricity assuming till 300 units the bill will be zero any thing above 300 price per unit is 7 rs
1. Rember input provided as units
2. units = units - 300
3. if units < 0
4. units = 0
5. say units * 7