THINKER TRONE

By AF


Skip to main content

THINK TRONE 


ANNAI COLLEGE OF ENGINEERING AND TECHNOLOGY
DEPT OF CSE 

print(7)                   
print()                
print(7+7)          
print( " 7+7 ")     
print(7 , 7+7  ) 
print(" hi ")
#print( hi  ) #error 
# by faisal






#integer = numbers = print(555)= output = 555
#string = letters = print(hi)= output = error
#string = letters = print(“hi”)= output = hi

'''
#program 1:
print('hi')# hi
print('welcome')# welcome
print(777)# 777
'''

'''
#Program 2:
x = 'cat'
y = 'cow'
z = 'carrot'
faizal = 777
faisal = 'no thinking to say'
print('y =',y)
print('z =',z)
print('x =',x)
print('faizal =',faizal)
print('faisal =',faisal)
print('faisal =',id(faisal))
print('faisal =',type(faisal))
'''
#Program 3:
#x,y,a,b = 7,5,90,65.4
#z = x+y
#f = (y+x*a-(b*y))
#print(f)
#print(5+7*90-(65.4*5))
#print('value of x and y =',x,'and',y)
#print("x+y =",z)
#print('value of x,y,z',x,y,z)
#print('''hi how are u this is multiline print
#yep you can print like this long statement
#by using ("""  """)''')


'''
#Program 3: operators +,-,*,/,<,>,= and, or, not
x,y = 8,2
print('x//y =',x//y, 'x%y =',x%y, 'x+y =',x+y, 'x-y =',x-y)
print('x*y =',x*y, 'x/y =',x/y, 'x**y =',x**y, 'x*x*x =',x*x*x)
print(x * 'af ')
print('c:\docs\name')
print(r'c:\docs\name')
print(' hi \n friends')
x = x+2
print('x =',x,'x+2 =',x+2)
x+=2
print('x+2 =',x)
x=-x
print('x=-x =',-x)
''''''

#Program 4:
r,t,u = 5,10,'youtube'
print(u+'is super')
print(u[0],u[1],u[0:4],u[1:],u[:3],u[3:10])
print('my' + u[3:])
print(len('myway'))
'''

'''
#Program 5: list[]
nums = [25,35,67,14]
print(nums[0],nums[3],nums[2:],nums[-3])
value = [73, 'fish', 45, 'water']
print(value)
newlist = [nums+value,value,nums]
print(newlist)
nums.append(45)
nums.insert(2,77)
nums.remove(14)
nums.pop(0)
print(nums)
del nums[2:]
print(nums)
nums.extend([3,34,55])
print(nums)
print(max(nums))
print(sum(nums))
nums.sort()
print(nums)
'''

'''
#Program 6: tuple() immutable
nums = (21, 34, 'tt')
#print(type(nums))
print(nums[1:3])

#Program 7: set{} no index value work not support dublicat value
s = {33, 44, 44, 'ttt'}
#print(type(s))
print(s)
'''
'''
#Program 8: dictionnary {'keys': 'value'}
d = {'k1':'man', 'k2':'car', 'k3':'water'}
print(d.keys())
print(d.values())
print(d['k2'])
print(d.get('k3'))

#Program 9:
a,b,c,d,e = 2.5,3+7j,5,4,8
print('a =',type(a),'b =',type(b),'c =',type(c))
print('d>e =',d>e,'d<e =',d<e)
print(int(True),int(False))
range(0, 20)
print(list(range(18)))
'''

'''
#Program 10: decimal base 10 = 0-9 ; binary base 2 = 0-1 ;
#Octal base 8 = 0-7 ; HexaDecimal base 16 = 0-9a-f ;
# decimal (25) to binary (0b11001) 25,12,6,3,1
#                                      1,0,0,1,1 reverse 11001 = 25

print('binary(25) =',bin(25),'Octal(25) =',oct(25),'HexaDecimal(25) =',hex(25))
'''

'''
#Program 11: swap
a,f = 7,5
temp = a
a = f
f = temp
print('a =',a,'f =',f)
#swap method 2
ant,fall = 7,5
ant = ant + fall  #a = a + b 11
fall = ant - fall #b = a - b 5
ant = ant - fall  #a = a - b 6
print('ant =',ant,'fall =',fall)
#swap method 3
ant,fall = 7,5
ant = ant ^ fall  #a = a ^ b
fall = ant ^ fall #b = a ^ b
ant = ant ^ fall  #a = a ^ b
print('ant =',ant,'fall =',fall)
#swap method 4
bat,ball = 55,77
bat,ball = ball,bat # route two in python
print('bat =',bat,'ball =',ball)
'''
'''
#Program 12: ~1 = 0 ; ~0 = 1 ; compliment ~00001100 = 11110011
print(~12)

#Program 13: maths,floor,ceil
import math
x = math.sqrt(25)
print(x)
print(math.floor(2.5))
print(math.ceil(2.5))
print(math.pow(3,2),'pi =',math.pi,'epcilon =',math.e)

#Program 14:
x = int(input('enter the value\n'))
y = int(input('enter the value\n'))
ch = input('charactor\n')
cha = input('charactor\n')[0]
print(cha)
print(x+y)
print(ch)
print(ch[0])
''' '''
#Program 15:
result = eval(input('enter the expretion'))
print(result)
'''
'''
#Program 16: if con
x = int(input('enter the value\n'))
r = x % 2
if r == 0:
    print('even\n')
if(r == 1):
    print('odd\n')
print('finish\n\n')
#program
if r == 0:
    print('even\n')
else:
    print('odd\n')
print('finish\n\n')
#program
if r == 0:
    print('even\n')
    if x>5:
        print('great\n')
    else:
        print('not great\n')
else:
    print('odd\n')
print('finish\n')
#program
if x == 1:
    print('is 1\n')
elif x==2:
    print('is 2\n')
elif x == 3:
    print('is 3\n')
else:
    print('wrong\n')
''''''
#Program 17: while
i = int(input('enter the value\n'))
while i <= 5:
    print('AF')
    i = i+1 '''
#program
'''
i = 1
while i <= 5:
    print('AF',i)
    i = i+1
#program
i = 5
while i >= 1:
    print('AF',i)
    i = i-1 ''''''
#program
i = 1
while i <= 5:
    print('AF',i)
    j=1
    while j<= 4:
        print('BF',j)
        j = j+1
    i = i+1
#program
i = 1
while i <= 5:
    print('AF',i,end="")
    j=1
    while j<= 4:
        print('BF',j,end="")
        j = j+1
    i = i+1
    print()'''
'''#Program 17 for loop
x = ['AF', 9, 8, 'oii']
for i in x:
    print(i)
print('        ')
#
x = 'ALAN AF'
for i in x:
    print(i)
#
for i in [2,3,5,'man','cat']:
    print(i)
#
for i in range(10):
    print(i)
#
for i in range(0,10,2):
    print(i)
#
for i in range(10,5,-1):
    print(i)
#
for i in range(0,7):
    if i!=5:
        print(i)
'''
'''#Program 18:
av = 10
x = int(input('how may candies\n'))
i = 1
while i <= x:

    if i>av:
        print('out stock')
        break
    print('candy')
    i+=1
print('bye')
#
for i in range(1,101):
    if i%3==0:
        pass
print('bye')
#
for i in range(1,101):
    if i%3==0 or i%5==0:
        continue
    print(i)
print('bye')'''
'''
#Program 19:
for i in range(4):
    print('#',end='')
print()
for i in range(4):
    print('#',end='')
print()
#
for i in range(4):
    for j in range(4):
        print('#',end='')
    print()
#
for i in range(5):
    for j in range(i):
        print('#',end='')
    print()
#
for i in range(5):
    for j in range(4-i):
        print('#',end='')
    print()
''' '''
#Program 19: for else

nums = [12, 5, 51, 73, 15]
for num in nums:

    if num % 5 == 0:
        print(num)
        break
#
nums = [11, 51, 73]
for num in nums:

    if num % 5 == 0:
        print(num)
        break
else:
    print('not found')'''
'''
#Program 20: prime or not
nums = 7
for i in range(2,nums):
    if nums % i == 0:
        print('not prime')
        break
else:
    print('prime')
'''
'''
#Program 21: array
from array import *
val = array('i',[3,4,6,7])
print('buffer_info',val.buffer_info())

val = array('i',[3,4,6,7])
print('printing',val)

val = array('i',[3,4,6,7])
print('typecode',val.typecode)

val = array('i',[3,4,6,7])
print('[1]index value of array',val[1])

val = array('i',[3,4,6,7])
val.reverse()
print('reverse the ',val)

val = array('i',[5, 9, -8, 4, 2])
for i in range(5):
    print('array printing element',val[i])
print()
print()
val = array('u',['a', 'y', 'u', 'n', 'l'])
for e in val:
    print('array printing element',e)
print()
val = array('i',[5, 9, -8, 4, 2])
newarray = array(val.typecode,(a for a in val))
for e in newarray:
    print('array printing element',e)
print()
val = array('i',[5, 9, -8, 4, 2])
newarray = array(val.typecode,(a*a for a in val))
for e in newarray:
    print('array printing element',e)
print()

val = array('i',[])
n = int(input('enter the length of the array'))

for e in range(n):
    x = int(input('enter the next value'))
    val.append(x)

print('array printing element',val)
vals = int(input('enter the value for sreach'))
k = 0
for e in val:
    if e == vals:
        print(k)
        break
    k+=1
'''
'''
#Program 22: function
def functionname():
    print('hi')
    print('guys')

functionname()

def add(x,y):
    c = x+y
    print(c)

add(5,7)

def add(x,y):
    c = x+y
    return(c)

result = add(6,8)
print(result)

def add_sub(x,y):
    c = x+y
    d = x-y
    return(c,d)

result1,result2 = add_sub(6,8)
print(result1,result2)



def update(x):
    x = 7
    print('x =',x)

a = 10
update(a)# pass value
print('a =',a)



def update(x):
    x = 7
    print(id(x))
    print('x =',x)

a = 10
print(id(a))
update(a)# pass value
print('a =',a)

def update(lst):
    lst[1] = 25
    print(id(lst))
    print('x =',lst)

lst = [10, 20, 30]
print(id(lst))
update(lst)# pass value
print('lst =',lst)

# actual Arguments 4 types position, keyword, default, variable length

def add(x,y): #formal arguments
    c = x+y
    print(c)

add(5,7)#Actual Arguments #position

def person(name,age = 18):
    print(name)
    print(age - 5)
   
person(name='apple',age=28)#key word arument
person(name='apple')#defult
#variable length argument
def add(x,*y):
    print(x)
    print(y)
    c = a
    print(c)
    for i in y:
        c = c + i
    print(c)

add(5,7,34,78)
#
def add(*y):
    print(y)
    c = 0
    print(c)
    for i in y:
        c = c + i
    print(c)

add(5,7,34,78)
#keyword variable length arugument
def person(name, **data):
    print(name)
    print(data)

person(name ='faisal', age = 20, city = 'taikkal', mob = 7548878475)
#
def person(name, **data):
    print(name)
    print(data)
    for i,j in data.items():
        print(i,j)

person(name ='faisal', age = 20, city = 'taikkal', mob = 7548878475)
''' '''
#Program 22:globle

a = 10 #globle varible
def something():
    a = 15 #local varible
    print('in side funtion',a)
   
something()
print('out side function',a)
print()
#
a = 10 #globle varible
def something():
    print('in side funtion',a)
   
something()
print('out side function',a)
print()
#
a = 10 #globle varible
def something():
    global a
    a = 15 #local varible
    print('in side funtion',a)
    5
something()
print('out side function',a)
#
a = 10 #globle varible
print(id(a))
def something():
    a = 9
    x = globals()['a']
    print(id(x))
    print('in side funtion',a)
    globals()['a'] = 15
something()
print('out side function',a)
''' '''
#Program 24:
def count(lst):

    even = 0
    odd = 0

    for i in lst:
        if i%2 == 0:
            even += 1
        else:
            odd += 1
    return even,odd
lst = [20, 40, 12, 15, 17, 78, 26]
evens, odds = count(lst)
print(evens)
print(odds)
print('Even : {} and Odd : {}'.format(evens,odds))
''' '''
#Program 25: fibonacci Sequence
def fibonacci(n):
    a = 0
    b = 1

    if n == 1:
        print(a)
    else:
        print(a)
        print(b)

        for i in range(2, n):
            c = a + b
            a = b
            b = c
            print(c)
fibonacci(2)
''' '''
#Program 25:
def fibonacci(n):
    a = 0
    b = 1
    if n < 0:
        print('wrong input')
    elif n == 1:
        print(a)
    else:
        print(a)
        print(b)

        for i in range(2, n):
            c = a + b
            a = b
            b = c
            print(c)
fibonacci(7)
#Program 28:factorial
print()
def fact(n):
    f = 1
    for i in range(1, n+1):
        f = f*i
    return f
x = 4
result = fact(x)
print(result)
#Program 29:recursion
print()
import sys
sys.setrecursionlimit(100)
print(sys.getrecursionlimit())
i = 0
def greet():
    global i
    i += 1
    print('hello', i)
    greet()
greet()''' '''
#Program 30:factorial using recursion

def fact(n):

    if n == 0:
        return 1
    return n * fact(n-1)

   

   
result = fact(5)
print(result)
#Program 31: Anonymous Function or Lambda in python
def seq(a):
    return a*a
result = seq(5)
print(result)
#
f = lambda a : a*a
result = f(5)
print(result)
#
f = lambda a,b : a+b
result = f(5,8)
print(result)
#filter map reduce
def is_even(n):
    return n%2 ==0

num = [3,4,4,6,7,8,9,44]
evens = list(filter(is_even,num))
print(evens)
#
num = [3,4,5,6,7,89,9,44]
evens = list(filter(lambda n : n%2 ==0,num))
print(evens)
#
from functools import reduce
num = [3,4,5,6,7,89,9,44]
evens = list(filter(lambda n : n%2 ==0,num))
doubles = list(map(lambda n : n*2,evens))
print(doubles)
sum = reduce(lambda a,b : a+b, doubles)
print(sum)''' '''
#Program 32: decorators
def div(a,b):
    print(a/b)
def smart_div(func):
    def inner(a,b):
        if a<b:
            a, b = b, a
        return func(a,b)
    return inner
div1 = smart_div(div)
div1(2,4)
#Program 34:
print(__name__)
''' '''
#Program 35: oops(Attributes, Behaviour)
#Attributes => Variables
#Behaviour  => Methods[Function]

class Computer:
    def config(self):
        print('i5, 16gb, 1tb')
a = '8'
print(type(a))
com1 = Computer()
print(type(com1))
''' '''
#
class Computer:
    def config(self):
        print('i5, 16gb, 1tb')
com1 = Computer() 
com2 = Computer()

Computer.config(com1)
Computer.config(com2)

com1.config()
com2.config()
#
class Computer:
    def __init__(self,cpu,ram):
        self.cpu = cpu
        self.ram = ram
   
    def config(self):
        print('Config',self.cpu, self.ram)
       
com1 = Computer('i5',16)#Constructor allows to give size 
com2 = Computer('ryzen 3',8)


com1.config()
com2.config()
''' '''
#Program 36: Constructor
class Computer:
    def __init__(self):
        self.name = 'king'
        self.age = 20
   
    def update(self):
        self.age = 23
       
com1 = Computer()
com2 = Computer()

com1.name = 'dem'
com1.update()
print(com1.name)
print(com2.name)
'''
'''
class K:
    def c(self):
        print("jjjj")
co= K()
K.c(co)
co.c()'''

'''
class A:
    def __init__(self):
        print("init")

    def c(self):
        print("ani")
co2=A()
co= A()

co.c()

co2.c()'''

'''
class F:
    def __init__(self, cpu, ram):
        self.cpu = cpu
        self.ram = ram
    def f(self):
        print("anitha", self.cpu, self.ram)

ob = F('af',17)
ob1= F('ryzen',7)

ob.f()
ob1.f()
'''
'''
class F:
    def __init__(self, x, y, m, n):
        self.x= x
        self.y = y
        self.m = m
        self.n = n
    def f(self):
        print("anitha", self.x, self.y)
        print("anitha", self.m+self.n)

ob = F('af',17, 5, 7)
ob1= F('ryzen',7, 8, 9)

ob.f()
ob1.f()
#program
class Car:
    def __init__(self, wheel, sit, color, breaks):
        self.wheel = wheel
        self.sit = sit
        self.color = color
        self.breaks = breaks

    def f(self):
        print("car = ", 'WHEELS ',self.wheel,',', 'SIT ',self.sit,',','COLOR ',self.color,',', 'BREAR',self.breaks)
       

ob = Car(4, 4, "red", 1)
ob1= Car(4, 6, 'blue', 1)

ob.f()
ob1.f()
'''
'''
class Std:

    def __init__(self, name, roll):
        self.name = name
        self.roll = roll
        self.lap = self.Lap()

    def show(self):
        print(self.name, self.roll)
        self.lap.show()

    class Lap:

        def __init__(self):
            self.brand = 'Hp'
            self.cpu = 'ir'
            self.ram = 7

        def show(self):
            print(self.brand, self.cpu, self.ram)

s1 = Std('faisal', 14)
s2 = Std('anitha', 5)

s1.show()
s2.show()
''' '''
#inhertance
#lap1 = s1.lap
#lap2 = s2.lap


class A:
    def __init__(self):
        print('a')
       
    def fe(self):
        print('f1')
    def fe1(self):
        print('f2')

class B(A):
    def __init__(self):
        super().__init__()
        print('b')
       
    def fe3(self):
        print('f3')
    def fe3(self):
        print('f4')

class C(B):
    def fe5(self):
        print('f3')
    def fe6(self):
        print('f4')


a1 = A()
b1 = B()
c1 = C()
a1.fe()
a1.fe1()
b1.fe()
c1.fe()
b1 = B()
''' '''
#Program 36: Polymorphism
#duck Typing, OPerator Overloading, method overloading, method overiding
#duck typing

class pycharm:
    def execute(self):
        print('compiling')
        print('running')

class Myeditor:
    def execute(self):
        print('spell chenk')
        print('convention check')
        print('compiling')
        print('running')
       
class Laptop:

    def code(self, ide):
        ide.execute()
       
ide = pycharm()
lap1 = Laptop()
lap1.code(ide)
print()
#
class pycharm:
    def execute(self):
        print('compiling')
        print('running')

class Myeditor:
    def execute(self):
        print('spell chenk')
        print('convention check')
        print('compiling')
        print('running')
       
class Laptop:

    def code(self, ide):
        ide.execute()
       
ide = Myeditor()
lap1 = Laptop()
lap1.code(ide)
print()

#OPerator Overloading (operands = 5, operator = +-*% )
class Student:

    def __init__(self,m1,m2):
        self.m1 = m1
        self.m2 = m2

    def __add__(self,other):
        m1 = self.m1 + other.m1
        m2 = self.m2 + other.m2
        s3 = Student(m1,m2)
        return s3
   
    def __gt__(self,other):
        r1 = self.m1 + self.m2
        r2 = other.m1 + other.m2
        if r1 > r2:
            return True
        else:
            return False

    def __str__(self):
        return '{} {}' .format(self.m1, self.m2)

s1 = Student(58,69)
s2 = Student(60,79)

s3 = s1 + s2

print(s3.m1)
print(s3.m2)

if s1 > s2:
    print('s1 wins')
else:
    print('s2 wins')

print(s1.__str__())
print(s1)
print()

#method overloading
#if u have same name method in a class a,b and a, b, c
#method overiding
#two method same name same parameters
#method overloading

class Student:

    def __init__(self,m1,m2):
        self.m1 = m1
        self.m2 = m2

    def sum(self,a=None,b=None,c=None):
        s = 0
        if a!=None and b!=None and c!=None:
            s = a+b+c
        elif a!=None and b!=None:
            s = a+b
        else:
            s = a
        return s
       
  
s1 = Student(58,69)
s2 = Student(60,79)

print(s1.sum(5,9,9))
print(s1.sum(5,9))
print(s1.sum(5))
print()
#method overiding
class A:
    def show(self):
        print('in A show')

class B(A):
    def show(self):
        print('in B show')

a1 = B()
a1.show()
''' '''

#Program 37: iterator
nums = [4,7,5,6,3]
it = iter(nums)
print(it.__next__())

print(next(it))
print(next(it))
print(next(it))
print(next(it))
print()
for i in nums:
    print(i)
#program
print()
class Topten:

    def __init__(self):
        self.num = 1

    def __iter__(self):
        return self

    def __next__(self):
        if self.num <= 10:
            val = self.num
            self.num += 1

            return val
        else:
            raise StopIteration

values = Topten()
print(values.__next__())
print(values.__next__())

for i in values:
   
    print(i)
print()

#Program 38: Generators

def topten():
    yield 1
    yield 2
    yield 3
    yield 4
    yield 5

values = topten()
print(values)
print(values.__next__())
print(values.__next__())

for i in values:
    print(i)
#program
print()
def topten():

    n = 1

    while n <= 10:
        sq = n*n
        yield sq
        n += 1
   
values = topten()
for i in values:
    print(i)
'''
# By A.FAISAL  AF 






THINK TRONE 


ANNAI COLLEGE OF ENGINEERING AND TECHNOLOGY
DEPT OF CSE 

print('faisal')

let's start...



Data types
x = 1    # int
y = 2.8  # float
z = 1j   # complex
print(type(x))
print(type(y))
print(type(z))
Integers:
x = 1
y = 56222554887711
z = -9255522

print(type(x))
print(type(y))
print(type(z))
Floats:
x = 6.10
y = 1.0
z = -75.59

print(type(x))
print(type(y))
print(type(z))
Floats:
x = 37e3
y = 19E4
z = -86.7e100

print(type(x))
print(type(y))
print(type(z))
Complex:
x = 4+5j
y = 7j
z = -5j

print(type(x))
print(type(y))
print(type(z))

Convert from one type to another:
x = 1 # int
y = 7.80 # float
z = 1j # complex

convert from int to float:
a = float(x)

convert from float to int:
b = int(y)

convert from int to complex:
c = complex(x)

type print

print(a)
print(b)
print(c)

print(type(a))
print(type(b))
print(type(c))
 
 


made with FireAlpaca64 




 
WINDOWS MOVIE MAKER 10

 
by af

© 2021 Thinker Trone . All Rights Reserved