# Day 1

## integer

a = 2 b = 3

## mathematical operation

print(a+b, a-b, a*b, a/b, a//b, a\**&#x62;) # sum, sub, mul, div, power (2^3)

a > b a < b

## strings

a = "shariq" b = "magistersign"

print(a, b) print(a + b)

firstName = "shariq" lastName = "abcd" empty = " "

print(firstName + "|" +lastName) # string concatenation

## built-in attributes of print function

print(firstName, lastName, sep = ":")

## float

a = 1.1 b = 1.3 print(a + b)

print( 1 + 1.2 ) print("shariq" + 1)

print("shariq"\*2)

## boolean: True or false

a = False b = True

## if conditions, if a == True, while True (infinite)

response = a > b

print(-3//2, -3/2, 2**3, 2**&#x32;*\*3) print(2*2\*3)

## variable names:

2numnber = 2 # wrong var r = 4 # wrong

var\_1 = 2 # right Var = 3 # right secondName = 2

## type, int, float, bool, string

type(secondName)

## type cast: cast a type (

e = '2' r = int(e) type(r)

e = 2 r = str(e) type(r)

bool(1) bool(0)

## input, adding string to integer

user = input("enter an input")

"shariq" + 1

user = int(input("enter integer value"))

## eval

user = eval(input("enter value"))

## boolean

user = bool(input("enter something"))

## r = google.com

## e = request("google.com")

{% tabs %}
{% tab title="First Tab" %}

{% endtab %}

{% tab title="Second Tab" %}

{% endtab %}
{% endtabs %}

#### comparison types, > ,<, == (to check), = (assignment)

## Compare strings

```
1 > 1 
2 > 2 
3 == 3 
1.1 == 1.1
```

"shariq" == "Shariq" "shariq" == "shariq" "shariq" > "Shariq" "a" > 'A'

## character encoding, h (23) -> binary

**Task:** the difference between ascii code and utf character encoding

## ord()

```
ord("a") ord('A')
ord('s') ord("S")
"shariq" > "sHariq" print(ord("a"), ord("b")) print(ord("A"), ord("B"))
"abcd" > "abcD"
chr(3432)
```

**Task:**&#x20;

1. max number of values in utf vs ascii
2. which character encoding does your Microsoft word uses

#### is, in - membership operator

```
r = 1 f = 1 r is f
```

## in

```
"q" in "shariq"
```

#### or and

"q" in "shariq" # sharik, sharique 1 and 0 or 1

```
"que" in "shariq" or "k" in "shariq"
```

## 1 or 0

False or False and True

{% file src="<https://2573864765-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MIKiZdQ_bTjr_3G7hUj%2F-MIoggcUYJNA82C0tk5K%2F-MIogms9EgNUcmx0cIHc%2Fday1.py?alt=media&token=1cdd81f8-70ac-4d4b-9685-553c05b6399a>" %}
Day 1
{% endfile %}
