Django Learning with Jeswanth

All videos are available here:    https://www.youtube.com/playlist?list=PLF9fJE4vTtTLnXYzr_19r1NVRWuNV892t

Access all the videos here

BASIC INFORMATION

For Basic information like installation, software to use, history, refer this link:

#Server DB Server(Modal – SQL) Controller (Python) View (HTML, Javascript)

print(‘Hello There’);print(“How are you?”)

print(5+3);
print ( “5+3=”,5+3,“and 6*2 =”, 6*2 )
# y = x+5, find the value of y when x is 4
# 5 is constant – value will remain 5
# x,y – their value can change – variables
# x independent variable, we can put any value
# y is dependent variable (on x), it can take multiple values but that depends on x

#calculate area and perimeter of a rectangle
l=50
b=85
#input values
# input – process (formula) – output (display the result)
area = l * b
perimeter = 2*(l+b)
print(“Rectangle with length”,l,“and breadth”,b,“has an area of”,area,“and perimeter of”,perimeter)

# f-string – formatting the string
print(f”Rectangle with length {l} and breadth {b} has an area of {area} and perimeter of {perimeter})

#calculate area and circumference of a circle
#independent variable here is radius
r = 13
area = 3.14 * r * r #pi is constant value 3.14
c = 2*3.14*r
#area and c are dependent variables
print(“Circle with radius”,r,“will have area of”,area,“and circumference of”,c)
print(f”Circle with radius {r} will have area of {area:.1f} and circumference of {c:.4f})

name,team,pos=“Virat”,“India”,“Captain”
print(f”Player’s name is {name:<10} from the team {team:^10} and represents as {pos:>15} at the event.”)
name,team,pos=“Manbgwabe”,“Zimbabwe”,“Wicket-Keeper”
print(f”Player’s name is {name:<10} from the team {team:^10} and represents as {pos:>15} at the event.”)

#numeric data types – int, float n complex
var1 = 50 #int – integer, numbers without decimal point
print(type(var1)) #type() – will give the type of the data that is stored
var1 = 50.0 #float
print(type(var1))
var1 = 5j # complex
# square root of -1 : i (in python we say j)
print(type(var1))
print(5j * 5j)
#text type – string (str)
”’ This is a
multi line
comment in python”’
var1 =‘5’
print(type(var1)) #<class ‘str’>
var1 = True #bool – True or False
print(type(var1))
# 5 types: int, float, bool, str,complex
#arithematic
val1, val2 = 20,3
print(val1 + val2) #adding
print(val1 – val2) #subtracting
print(val1 * val2) #multiplying
print(val1 / val2) #dividing – gives a float value
print(val1 // val2) # integer division – gives integer value
print(val1 ** val2) #power
print(val1 % val2) #mod – remainder

# 20/3 = 6 2/3
#conditional / relational operators: > < >= <= == !=
# output: True or False
val1, val2,val3 = 20,3,20
print(val1 > val2) #True
print(val1 >= val3) #T
print(val1 > val3) # F
print(val1 < val3) #
print(val1 <= val3) #T
print(val1 == val3)
print(val1 != val3)

# logical operator: and or not
#input is boolean and output is also boolean
print(False and False)
print(False and True)
print(True and False)
print(True and True)
print(“===============”)

print(False or False)
print(False or True)
print(True or False)
print(True or True)
print(not True)
print(not False)
print(“========”)
val1, val2,val3 = 20,3,20
print(val1 >= val3 and val1 > val3 or val1 < val3 and val1 <= val3 or val1 == val3)
# T
num= 0
if num>0:
print(“Positive”)
elif num<0:
print(“Negative”)
else:
pass

print(“Thank you”)

####
avg =75
#avg>=85: Grade A, 70-85: Grade B, 60 to 70: Grade C, 50-60: D, <50: E
# if avg>=50: You have passed!
if avg>=50:
print(“You’ve passed!”)
if avg >= 70:
print(“Grade A”)
if avg>=90:
print(“You win special award”)
elif avg >= 85:
print(“Grade B”)
elif avg >= 60:
print(“Grade C”)
else:
print(“Grade D”)
else:
print(“You’ve not passed!”)
print(“Grade E”)
#LOOPS – repeating a block of code
## FOR Loop: used when you know how many times to execute a code
## WHILE Loop: beforehand you are not sure how many times but repeat based on some condition
# for: when you know how many times you need to repeat something
# while:
# range(=start, < end, =increment) range(3,9,2): 3,5,7
for counter in range(3,9,2):
print(“HELLO, The counter value is”,counter)
##
for i in range(1,101): #when increment is not given, default value is 1
print(i)


#Generate even numbers from 2 to 100 (both inclusive)
n=12
for i in range(n): #when start number is not given, default value is zero
print(“* “,end=“”)
print()

”’
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
”’
for j in range(n):
for i in range(n):
print(“* “,end=“”)
print()

”’
*
* *
* * *
* * * *
”’
for j in range(n):
for i in range(j+1):
print(“* “,end=“”)
print()

”’
* * * *
* * *
* *
*
”’
for j in range(n):
for i in range(n-j):
print(“* “,end=“”)
print()

”’
* * * *
*
*
* * * *
”’
for j in range(n):
if j==0 or j==n-1:
for i in range(n):
print(“* “,end=“”)
print()
else:
for k in range(n-j-1):
print(” “,end=” “)
print(“*”)


#while
cont = “y”
while cont==“y”:
print(“Hello from While”)
cont = input(“Do you want to continue: hit y for yes anyother key for no:”)