From c5cd40c0650c539b3aedbe145b866d7344f3f97a Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Fri, 1 Aug 2025 12:32:06 +0600 Subject: [PATCH 001/115] section3 file added --- section3.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/section3.py b/section3.py index 476902d..53c1a6d 100644 --- a/section3.py +++ b/section3.py @@ -127,3 +127,7 @@ # txt1 = "Asif's age is 24" # txt2 = 'quote"jneajgnaj"' # print(txt1,txt2) +int_var = 342 +float_var = 231.34 +bool_var = True +com_var = 4 + 3j From 9107ad76e226da3a3e20c5e9d2e4ce2520333092 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Fri, 1 Aug 2025 13:05:25 +0600 Subject: [PATCH 002/115] bug fix from section1.py --- section1.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/section1.py b/section1.py index 96b0c89..b760b14 100644 --- a/section1.py +++ b/section1.py @@ -23,4 +23,5 @@ ls.append(last_dig) dig = dig //10 -print(ls) \ No newline at end of file +print(ls) +print("Hi i am section1-bug-fix") \ No newline at end of file From 04c628b2720972fbe584aa83e2f314715c0d912c Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Tue, 5 Aug 2025 11:47:17 +0600 Subject: [PATCH 003/115] Some codes has been added --- loops.py | 28 +++++++++++++++ section1.py | 102 +++++++++++++++++++++++++++++++++++++++++++++++----- section3.py | 78 +++++++++++++++++++++++++++++++++++++--- section4.py | 29 +++++++++++++++ 4 files changed, 224 insertions(+), 13 deletions(-) create mode 100644 loops.py diff --git a/loops.py b/loops.py new file mode 100644 index 0000000..68a72b6 --- /dev/null +++ b/loops.py @@ -0,0 +1,28 @@ +# print("Loops") +# num = int(input("Enter a number:")) +# sum =0 +# i =0 +# while(i<=num): +# sum+=i +# i=i+1 +# print(sum) +#maximum number +# i=0 +# num = 5 +# max =0 +# print("Enter numbers:") +# while i= max: +# max = dig +# i+=1 +# print(max) +#finding minimum number +num = int(input("Enter number of numbers:")) +i = 0 +min = 0 +print("enter ",num,"numbers") +while i min: + \ No newline at end of file diff --git a/section1.py b/section1.py index b760b14..ced63ab 100644 --- a/section1.py +++ b/section1.py @@ -16,12 +16,96 @@ # print(id(a),id(b),id(c)) # a=b=c=10 # print() -dig = 7895 -ls =[] -while dig!=0: - last_dig = dig % 10 - ls.append(last_dig) - dig = dig //10 - -print(ls) -print("Hi i am section1-bug-fix") \ No newline at end of file +# dig = 7895 +# ls =[] +# while dig!=0: +# last_dig = dig % 10 +# ls.append(last_dig) +# dig = dig //10 + +# print(ls) +# print("Hi i am section1-bug-fix") + +#section 1 - practice +# int_var = 342 +# float_var = 2342.55 +# bool_var = True +# str_var = "Asif" +# print(int_var,float_var,bool_var,str_var) + +# name,age,is_student = "Asif",24,True +# print(name,age,is_student) + +# print(id(name),id(age),id(is_student)) + +# a=b=c=1 +# print(a,b,c) +# print(id(a),id(b),id(c)) +#garbage collection +# a = 34 +# print(a,type(a)) +# a = "Hi" +# print(a,type(a)) +#rules for writing a variable +# aBz09 = 232 +# for = 1 +# 1var = 23 +#basic data type +# complex_var = 2+3j +# print(complex_var,type(complex_var)) +# li = [12,"Asif",True,23.22] +# for x in li: +# print(x) + +# li[1] = "Probin" +# print(li) + +# tu = (12,34.33,"Tuple",False) +# for x in tu: +# print(x) + +# print(tu[0],tu[1]) +# tu[0] = 100 +str = "Hi Bro I love Python" +# for x in str: +# print(x) + +# for i in range(len(str)): +# print(str[i]) +# str[0] = "A" +# se ={12,22,11,"Asif",True} +#numeric type +# x = 3923322 +# print(x) +# import sys +# print(sys.getsizeof(x)) +# x = 232111 +# float_type = 23332223242.3222223232232323223 +# print(sys.getsizeof(float_type)) +# f = 23223e3 +# n = int(input()) +# i=0 +# while i Date: Tue, 5 Aug 2025 11:56:55 +0600 Subject: [PATCH 004/115] readme branch deleted --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index ec8e50e..60d4884 100644 --- a/readme.md +++ b/readme.md @@ -1 +1,2 @@ Here is a readme file to explore pull request +Here is a readme line for practicting git merge From 0bc91cc1dd2ee784ef27ddfee2b81b9678c7c92c Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Tue, 5 Aug 2025 19:10:50 +0600 Subject: [PATCH 005/115] 5 Auguest - string practice --- string.py | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/string.py b/string.py index 4da5536..779242d 100644 --- a/string.py +++ b/string.py @@ -20,4 +20,49 @@ # print(str2[i]) # for i in range(len(str3)): -# print(str3[i]) \ No newline at end of file +# print(str3[i]) + +#string - collextion of characters enclosed in '',"",'''''' +str1 = 'Hello Python' +str2 = "Hello Bro" +str3 = '''I love Python''' +# print(str1,type(str1)) +# print(str2,type(str2)) +# print(str3,type(str3)) + +# print(str1[2]) +# print(str2[0]) +# print(str3[2]) +#python supports negative indexes +# print(str1[-1]) +# print(str2[-3]) +# print(str3[-5]) +# len1 = len(str1) +# len2 = len(str2) +# len3 = len(str3) +# print(len1,len2,len3) +#counting length with for loop +# count =0 +# for x in str1: +# print(x) +# count=count + 1 +# print("length is ",count) +# count =0 +# for x in str2: +# print(x) +# count=count + 1 +# print("length is ",count) +# count =0 +# for x in str3: +# print(x) +# count=count + 1 +# print("length is ",count) +for i in range(len(str1)): + print(str1[i]) + +for j in range(len(str2)): + print(str2[j]) + +for k in range(len(str3)): + print(str3[k]) + \ No newline at end of file From 87ae9e59745638797c74cf3f423e63dc66591ec2 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Tue, 5 Aug 2025 21:46:41 +0600 Subject: [PATCH 006/115] 5 auguest practice --- string.py | 56 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/string.py b/string.py index 779242d..3e76eb2 100644 --- a/string.py +++ b/string.py @@ -57,12 +57,54 @@ # print(x) # count=count + 1 # print("length is ",count) -for i in range(len(str1)): - print(str1[i]) +# for i in range(len(str1)): +# print(str1[i]) + +# for j in range(len(str2)): +# print(str2[j]) + +# for k in range(len(str3)): +# print(str3[k]) + +#string literal +# str1 ="""This is a +# multiline string and +# we are practicing it""" +# print(str1) + +# txt1 = "Asif's" +# txt2 = 'Probin"s' +# print(txt1,txt2) + +#escape sequences +# print('Here is a \"') +# print("Here is a \'") +# print("Here is a tab \t") +# print("backslash \\") +# print("carriage return \r") +# print("backspace\b") -for j in range(len(str2)): - print(str2[j]) +#indexing and slicing +# str = "Asif" +# print(str[0]) +# # str[0]="b" +# str = "Probin" +# print(str) +# # for i in range(1:10:1): +# # print(i) +# s1 = str[1:3:1] +# print(s1) -for k in range(len(str3)): - print(str3[k]) - \ No newline at end of file +# str = "Hi i love python" +# # print(str[1:8:1]) +# s1 = str[-1:10:-1] +# print(s1) +#string operation +# str1 ="Hi" +# str2 ="Bro" +# print(str1 +" "+ str2) +# print(str1*10) +# print('apple'<'ball'<'cat'<'dog') +# print('apple'<'apply') +# print('cat'<'catch') +# print("123"<'abc'<'ABC') From 56dbebb789c3c7a6fef81269b2a9e3ff9b943506 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Wed, 13 Aug 2025 13:05:33 +0600 Subject: [PATCH 007/115] section 3 revise codes added --- section3_revise.py | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 section3_revise.py diff --git a/section3_revise.py b/section3_revise.py new file mode 100644 index 0000000..22963c7 --- /dev/null +++ b/section3_revise.py @@ -0,0 +1,57 @@ +print("Variable and data type revise") +#section 3 revise - data type +#calculate biil amount +# bills =[120,221,321,95,43] +# amount =[600,800,1000,400,256] +# for x in range(len(bills)): +# total = bills[x]*amount[i] + +# print (amount) +# var_name = 234 + +# num1 = 300 +# num2 = 400 +# sum = num1 +num2 +# print(sum) + +# str_var = "Asif" +# int_var = 2323234 +# float_var = 234.455 +# bool_var = True +# print(str_var,type(str_var)) +# print(int_var,type(int_var)) +# print(float_var,type(float_var)) +# print(bool_var,type(bool_var)) + +# name,age,isStudent = "Asif",24,True +# print(id(name),id(age),id(isStudent)) + +# a=b=c=10 +# print(id(a),id(b),id(c)) + +# var = 234 +# print(var) +# var = "Asif" +# print(var) +# var = False +# print(var) +# true = 45 +# false = 33 + +# complex_var = 34+32j +# print(complex_var) +# num = complex(2,3) +# print(num) + +# l = [23,21,"Asif",True] +# print(l,type(l)) +# for x in l: +# print(x) +# for i in range(len(l)): +# print(l[i]) + +# l[0]=100 +# l[1] = 50 +# l[2] ="Emon" +# l[3] = False +# print(l) From 169fee5bdfa1177e42c32c4c15309576f7f31822 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Wed, 13 Aug 2025 13:22:27 +0600 Subject: [PATCH 008/115] Practice codes added --- section3_revise.py | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/section3_revise.py b/section3_revise.py index 22963c7..8add4f5 100644 --- a/section3_revise.py +++ b/section3_revise.py @@ -1,3 +1,4 @@ +import sys print("Variable and data type revise") #section 3 revise - data type #calculate biil amount @@ -55,3 +56,58 @@ # l[2] ="Emon" # l[3] = False # print(l) + +# t=(23,44,22.33,True) +# for i in range(len(t)): +# print(t[i]) + +# t[0] = 100 + +# str ="I love python" +# for i in range(len(str)): +# print(str[i]) + +# str[0] ='U' +# str[3] = "A" + +#set +# set_var ={23,23,11,34,True} +# print(set_var) +# set_var = 100 +# print(set_var) + +# set1 ={23,22,11,44} +# set1.add(100) +# print(set1) + +#dictionary - collection of key value pair format +# dic ={ +# "name":"Asif", +# "roll":232311167, +# "dept":"Cse" +# } +# print(dic) + +#numeric type - all types are immutable +x = 1013883393300 +print(sys.getsizeof(x)) +f = 23422.63355 +print(sys.getsizeof(f)) +b = True +print(sys.getsizeof(b)) + +f1 = 23e-3 +print(f1) +f2 = 23E-2 +print(f2) + +int1 = 23e3 +print(int1) + +bool1 = True +bool2 = False +print(bool1,bool2) +print(int(bool1),int(bool2)) + +print(complex(2,1)) + From b04fcad0e30d9d46b868cfe222513034c3455039 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Wed, 13 Aug 2025 14:18:56 +0600 Subject: [PATCH 009/115] section 3 done --- section3_revise.py | 99 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 77 insertions(+), 22 deletions(-) diff --git a/section3_revise.py b/section3_revise.py index 8add4f5..8deb913 100644 --- a/section3_revise.py +++ b/section3_revise.py @@ -89,25 +89,80 @@ # print(dic) #numeric type - all types are immutable -x = 1013883393300 -print(sys.getsizeof(x)) -f = 23422.63355 -print(sys.getsizeof(f)) -b = True -print(sys.getsizeof(b)) - -f1 = 23e-3 -print(f1) -f2 = 23E-2 -print(f2) - -int1 = 23e3 -print(int1) - -bool1 = True -bool2 = False -print(bool1,bool2) -print(int(bool1),int(bool2)) - -print(complex(2,1)) - +# x = 1013883393300 +# print(sys.getsizeof(x)) +# f = 23422.63355 +# print(sys.getsizeof(f)) +# b = True +# print(sys.getsizeof(b)) + +# f1 = 23e-3 +# print(f1) +# f2 = 23E-2 +# print(f2) + +# int1 = 23e3 +# print(int1) + +# bool1 = True +# bool2 = False +# print(bool1,bool2) +# print(int(bool1),int(bool2)) + +# print(complex(2,1)) + +# int_a = 232_34_34 +# print(int_a) +# float_a = 232.443_242_232 +# print(float_a) + +# dec = 342 +# binary = bin(dec) +# octal = oct(dec) +# hexadecimal = hex(dec) +# print(binary,octal,hexadecimal) + +# decimal = dec(0b1010) +# print(decimal) + +#binary to hexadecimal +# int1 = 100 +# bin1 = bin(int1) +# print(bin1) + +# num ='0b1100100' +# int2 = dec(num) + +#type conversion + +# print(int(132)) +# print(int(233.442)) +# print(int(True)) +# print(int(False)) +# print(int("234")) +# # print(int(3+3j)) + +# print(float(234)) +# print(float(23.42)) +# print(float(True)) +# print(float(False)) +# # print(float(4+4j)) +# print(float("23.45")) + +# print(bool(1233)) +# print(bool(223.442)) +# print(bool(True)) +# print(bool("Asif")) +# print(bool(2+3j)) + +# print(complex(23)) +# print(complex(12.34)) +# print(complex(True)) +# print(complex(False)) +# print(complex("2+3j"))\ + +# print(str(232)) +# print(str(23.42)) +# print(str(True)) +# print(str(False)) +# print(str(2+4j)) \ No newline at end of file From bb111ff8af01ceb2f85f1884496109feaa695437 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Wed, 13 Aug 2025 20:30:03 +0600 Subject: [PATCH 010/115] section 4 revise codes added --- section4_revise.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 section4_revise.py diff --git a/section4_revise.py b/section4_revise.py new file mode 100644 index 0000000..698d425 --- /dev/null +++ b/section4_revise.py @@ -0,0 +1,41 @@ +print("operators and expression revise") + +#arithmetic operators(+,-,*,/,//,%,**) + +# num1 = 20 +# num2 = 10 +# add = num1 + num2 +# sub = num1 - num2 +# multi = num1*num2 +# div = num1/num2 +# print(add) +# print(sub) +# print(multi) +# print(div) + +# mod = num1 %num2 +# flo = num1 // num2 +# a,b = 3,5 +# expo = a**b +# print(expo) +# print(mod) +# print(flo) + +# a,b,c = 2,3,4 +# print(a**b**c) +# print(2**81) + +#expression - that results in value +# exp1 = 34+(2*4)/2 - 23 +12 +# print(exp1) + +# height = 30 +# base = 10 +# area = 0.5* height* base +# print(area) + +# a = 40 +# a += 20 +# print(a) + + From 3858ef21a5294accaac4f39bf3716f2c649145cc Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Thu, 14 Aug 2025 22:22:34 +0600 Subject: [PATCH 011/115] some problems solved --- problems.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 problems.py diff --git a/problems.py b/problems.py new file mode 100644 index 0000000..d53a43c --- /dev/null +++ b/problems.py @@ -0,0 +1,20 @@ +# print("Problems about data type ,variables") +# name = input("Enter your name:") +# age = int(input("Enter your age:")) +# height = float(input("Enter your height:")) + +# print(f"Name is {name} and age is {age} and height is {height}") + +# fav_foods = ["Pizza","Dragon","Biriyani"] +# print(fav_foods[0],fav_foods[2]) + +# str = "Python is awesome" +# print("length of the string:",len(str)) + +# apple = int(input("Enter number of apples:")) +# banana = int(input("Enter number of bananas:")) + +# total = 3 * apple + 2 * banana +# print(f"total is ${total}") + + From 19d834361db3bc4afe3db34e57cd8e9d90ddba72 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Thu, 14 Aug 2025 22:34:50 +0600 Subject: [PATCH 012/115] miscelleneuis --- .idea/.gitignore | 3 +++ .idea/PYTHON.iml | 8 ++++++++ .idea/inspectionProfiles/profiles_settings.xml | 6 ++++++ .idea/misc.xml | 4 ++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ section3.py | 1 + section4_revise.py | 2 +- 8 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/PYTHON.iml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/PYTHON.iml b/.idea/PYTHON.iml new file mode 100644 index 0000000..eb20ec8 --- /dev/null +++ b/.idea/PYTHON.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..c2837db --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f3dffd0 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/section3.py b/section3.py index 1088be7..ad0a155 100644 --- a/section3.py +++ b/section3.py @@ -201,3 +201,4 @@ # d = str(False) # e = str(23+3j) # print(a,b,c,d,e) + diff --git a/section4_revise.py b/section4_revise.py index 698d425..57d6d5f 100644 --- a/section4_revise.py +++ b/section4_revise.py @@ -38,4 +38,4 @@ # a += 20 # print(a) - + From 5adc6f0d24cb22b0325da44941af39e8e2357d2a Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Mon, 18 Aug 2025 13:59:50 +0600 Subject: [PATCH 013/115] OOP codes added --- OOP.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 OOP.py diff --git a/OOP.py b/OOP.py new file mode 100644 index 0000000..fe57933 --- /dev/null +++ b/OOP.py @@ -0,0 +1,17 @@ +print("Hello OOP") + +def sum(a,b): + return a + b + +print(sum(10,20)) + +seller1_name = "MD Asif" +seller1_id = 2323 +seller1_address = '23 street , Bangalore' + +seller2_name = "MD Emon" +seller2_id = 2324 +seller2_address = '24 street , Bangalore' + + +seller1 = ["Asif",2323,"23 street,Bangalore"] From f012325dbf089533dd3120aea4dfa1cdc38eb5dd Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Mon, 18 Aug 2025 15:07:49 +0600 Subject: [PATCH 014/115] oops codes --- OOP.py | 55 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/OOP.py b/OOP.py index fe57933..617f0b6 100644 --- a/OOP.py +++ b/OOP.py @@ -1,17 +1,52 @@ print("Hello OOP") -def sum(a,b): - return a + b +# def sum(a,b): +# return a + b -print(sum(10,20)) +# print(sum(10,20)) -seller1_name = "MD Asif" -seller1_id = 2323 -seller1_address = '23 street , Bangalore' +# seller1_name = "MD Asif" +# seller1_id = 2323 +# seller1_address = '23 street , Bangalore' -seller2_name = "MD Emon" -seller2_id = 2324 -seller2_address = '24 street , Bangalore' +# seller2_name = "MD Emon" +# seller2_id = 2324 +# seller2_address = '24 street , Bangalore' -seller1 = ["Asif",2323,"23 street,Bangalore"] +# seller1 = ["Asif",2323,"23 street,Bangalore"] + +# #seller1.method() + +# a = 30 +# print(type(a)) + +# class Car: +# pass + +# volvo = Car() +# print(volvo) +# print(type(Car)) + +# class Student: +# def __init__(arg1): +# name = "Asif" +# id = 2323 +# print(id(arg1)) +# print("Student class is called") + +# s1 = Student() +# print(id(s1)) + +class Student: + def __init__(self,name,id,profession): + self.name = name + self.id = id + self.is_student = profession + print("Object is created") + print(f"name is {self.name} id is {self.id} profession is {self.is_student}") + +s1 = Student("Asif",2323,"Student") +s2 = Student("Arfi",3433,"Baby") +print(s1.name,s1.id,s1.is_student) +print(s2.name,s2.id,s2.is_student) \ No newline at end of file From 6bdb90c2ddf467f84f22cf41d84cef869d7d7408 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Wed, 20 Aug 2025 14:23:13 +0600 Subject: [PATCH 015/115] operators and expression codes added --- section4_revise.py | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/section4_revise.py b/section4_revise.py index 57d6d5f..2be47aa 100644 --- a/section4_revise.py +++ b/section4_revise.py @@ -39,3 +39,57 @@ # print(a) +#assignment operator +# num1 = 24 +# num1+=12 +# print(num1) + +# num1 -= 20 +# print(num1) + +# num1*=10 +# print(num1) + +# num1 /= 5 +# print(num1) + +# num1 %=3 +# print(num1) + +#str er shudhu +,* hoy r bakigula hoy na + +#float + float = float + +# num1 = 20 +# num2 = 30 +# op1 = num1 + num2 +# op2 = num1 - num2 +# op3 = num1 * num2 +# op4 = num1 / num2 +# op5 = num1 // num2 +# op6 = num1 % num2 +# op7 = num1 ** num2 +# print(op1) +# print(op2) +# print(op3) +# print(op4) +# print(op5) +# print(op6) +# print(op7) + +num1 = 20 +num2 = 30 +op1 = num1 + num2 +op2 = num1 - num2 +op3 = num1 * num2 +op4 = num1 / num2 +op5 = num1 // num2 +op6 = num1 % num2 +op7 = num1 ** num2 +print(op1) +print(op2) +print(op3) +print(op4) +print(op5) +print(op6) +print(op7) \ No newline at end of file From 244a1155a701c145f3b056da5bb850c51aa6e4e9 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Wed, 20 Aug 2025 14:42:24 +0600 Subject: [PATCH 016/115] section 4 completed --- section4_revise.py | 114 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 98 insertions(+), 16 deletions(-) diff --git a/section4_revise.py b/section4_revise.py index 2be47aa..58b32f1 100644 --- a/section4_revise.py +++ b/section4_revise.py @@ -77,19 +77,101 @@ # print(op6) # print(op7) -num1 = 20 -num2 = 30 -op1 = num1 + num2 -op2 = num1 - num2 -op3 = num1 * num2 -op4 = num1 / num2 -op5 = num1 // num2 -op6 = num1 % num2 -op7 = num1 ** num2 -print(op1) -print(op2) -print(op3) -print(op4) -print(op5) -print(op6) -print(op7) \ No newline at end of file +# num1 = 20.45 +# num2 = 5.43 +# op1 = num1 + num2 +# op2 = num1 - num2 +# op3 = num1 * num2 +# op4 = num1 / num2 +# op5 = num1 // num2 +# op6 = num1 % num2 +# op7 = num1 ** num2 +# print(op1) +# print(op2) +# print(op3) +# print(op4) +# print(op5) +# print(op6) +# print(op7) + +# num1 = True +# num2 = True +# op1 = num1 + num2 +# op2 = num1 - num2 +# op3 = num1 * num2 +# op4 = num1 / num2 +# op5 = num1 // num2 +# op6 = num1 % num2 +# op7 = num1 ** num2 +# print(op1) +# print(op2) +# print(op3) +# print(op4) +# print(op5) +# print(op6) +# print(op7) + +# num1 = 4 + 5j +# num2 = 3+4j +# op1 = num1 + num2 +# op2 = num1 - num2 +# op3 = num1 * num2 +# op4 = num1 / num2 +# # op5 = num1 // num2 +# # op6 = num1 % num2 +# # op7 = num1 ** num2 +# print(op1) +# print(op2) +# print(op3) +# print(op4) +# print(op5) +# print(op6) +# print(op7) + +# num1 = "Asif" +# num2 = "Emon" +# op1 = num1 + num2 +# # op2 = num1 - num2 +# op3 = num1 * num2 +# # op4 = num1 / num2 +# # op5 = num1 // num2 +# # op6 = num1 % num2 +# # op7 = num1 ** num2 +# print(op1) +# print(op2) +# print(op3) +# print(op4) +# print(op5) +# print(op6) +# print(op7) + +#string concatenation +str1 = "Hello" +str2 = "World" + +s1 = str1 +" "+ str2 +print(s1) + +# print("Asif"+"23") +# print("12"+12) + +#in python ,concatenation happens if they are both string + +#multiplications +# str1 = "Asif" +# num = 4 +# multi = str1 * num +# print(multi) + +# c = "abc" +# print(c*2) + +import math +a = 1 +b = -5 +c = 6 + +x1 = (-b + math.sqrt(b*b - 4 * a * c))/(2*a) +x2 = (-b - math.sqrt(b*b - 4 * a * c))/(2*a) + +print(x1,x2) \ No newline at end of file From ae3e069a385fc4008ad14081c336341eb32751a2 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sat, 23 Aug 2025 13:42:48 +0600 Subject: [PATCH 017/115] day 7 added --- video7.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 video7.py diff --git a/video7.py b/video7.py new file mode 100644 index 0000000..82a3657 --- /dev/null +++ b/video7.py @@ -0,0 +1,17 @@ +#calculator program +num1 = int(input("Enter a number:")) +num2 = int(input("Enter another number:")) +add = num1 + num2 +sub = num1 - num2 +multi = num1 * num2 +div = num1 / num2 +mod = num1 % num2 +exp = num1 ** num2 +flo = num1 // num2 +print("Addition is:",add) +print("Subtraction is:",sub) +print("Multiplication:",multi) +print("Division is:",div) +print("Modulus is:",mod) +print("Subtraction is:",exp) +print("Floor division is:",flo) From cf27e971d5b39faf9cee1563816ae2b26312e88c Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sat, 23 Aug 2025 20:51:25 +0600 Subject: [PATCH 018/115] video 5 added --- video5.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 video5.py diff --git a/video5.py b/video5.py new file mode 100644 index 0000000..f1e0d67 --- /dev/null +++ b/video5.py @@ -0,0 +1,26 @@ +print("Hello Python") +#single line comment +#1st line +#ksnvkadnvkanmvkp +#dakjvadkfvka +#fdknvkdajaf + +'''this is a multiline +commnet which will not +execute +''' +"""this is another variant of +multiline commnet +where code is ignored +""" +#escape sequence character +# print("I am 24 year\"s old") +# print("Backslash is \\") +# print("single quotes \'") +# print("i am a student\ni am a student\ni am a student") +# print("tab \ttakes 4 spaces") +# print("carriage return \r") +# print("backspace \b") + +print("Hi",True,23,sep="-") +print("Hello",False,34,sep="/",end="\n") \ No newline at end of file From 2217069c95afc17af6318298e4a05cc4f5da396d Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sat, 23 Aug 2025 21:07:16 +0600 Subject: [PATCH 019/115] day 06 added --- video6.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 video6.py diff --git a/video6.py b/video6.py new file mode 100644 index 0000000..c53da50 --- /dev/null +++ b/video6.py @@ -0,0 +1,38 @@ +print("variable","&","Data type",sep=" ") +num1 = 20 +print(id(num1)) +counter = 1000 +price = 23.455 +can_vote = False + +# print(counter) +# print(price) +# print(can_vote) +# del price +# print(price) +#multiple assignment +# name,age,price = "Asif",24,25.99 +# print(id(name),type(name),name) +# print(id(age),type(age),age) +# print(id(price),type(price),price) + +# a=b=c = 100 +# print(id(a),id(b),id(c)) + +#local variable - cannot be accessed outside function +# def sum(): +# a=10 +# b = 20 +# c = a+b +# return c + +# print(a,b) + +#global variable +# x = 10 +# y = 15 +# def sub(): +# c = x - y +# return c + +# print(sub()) From a1af01b3edb7657467fa33788b1e39a727082a2b Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 24 Aug 2025 12:44:59 +0600 Subject: [PATCH 020/115] day 15 codes added --- video15.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 video15.py diff --git a/video15.py b/video15.py new file mode 100644 index 0000000..d4a8a14 --- /dev/null +++ b/video15.py @@ -0,0 +1,17 @@ +import time +time_stamp = time.time(); +print(time_stamp) +local_time = time.ctime(time_stamp) +print(local_time) + +time_string = int(time.strftime("%H")) +print(time_string) + +if(time_string>=6 and time_string<=12): + print("Good Morning") +elif(time_string >12 and time_string<=16): + print("Good Afternoon") +elif(time_string > 16 and time_string<=19 ): + print("Good Evening") +else: + print("Good Night") \ No newline at end of file From ee67de225a5357dea2f95fef37b4b3834ef1fc53 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Mon, 25 Aug 2025 13:34:28 +0600 Subject: [PATCH 021/115] video 14 added --- video14.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 video14.py diff --git a/video14.py b/video14.py new file mode 100644 index 0000000..b47f884 --- /dev/null +++ b/video14.py @@ -0,0 +1,34 @@ +print("conditional statement") + +# marks = 20 +# result = "" +# if marks<30: +# result = "Fail" +# elif marks >75: +# result = "Passed with distinction" +# else: +# result = "Passed" + +# print(result) + +# age = "" +# if age>18: +# print("He can drive") +# else: +# print("He cannot drive") + +# num = int(input("Enter a number:")) +# if(num<0): +# print("negative") +# else: +# print("positive") + +amount = int(input("Enter amount:")) +dis = 0 +if (amount>1000): + dis = (amount * 10)/100 + amount_to_pay = amount - dis + print("Payment after discount:",amount_to_pay) +else: + print("Discount is not available") + print("Payment is",amount) \ No newline at end of file From aeb28ea550c3bcb12f7406c84ef9bc1897373b99 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Mon, 25 Aug 2025 23:05:42 +0600 Subject: [PATCH 022/115] video 14 codes practiced --- video14.py | 89 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 80 insertions(+), 9 deletions(-) diff --git a/video14.py b/video14.py index b47f884..c8f92f2 100644 --- a/video14.py +++ b/video14.py @@ -23,12 +23,83 @@ # else: # print("positive") -amount = int(input("Enter amount:")) -dis = 0 -if (amount>1000): - dis = (amount * 10)/100 - amount_to_pay = amount - dis - print("Payment after discount:",amount_to_pay) -else: - print("Discount is not available") - print("Payment is",amount) \ No newline at end of file +# amount = int(input("Enter amount:")) +# dis = 0 +# if (amount>1000): +# dis = (amount * 10)/100 +# amount_to_pay = amount - dis +# print("Payment after discount:",amount_to_pay) +# else: +# print("Discount is not available") +# print("Payment is",amount) + +# num = int(input("Enter a number:")) +# if(num<0): +# print("negative") +# elif(num==0): +# print("zero") +# else: +# print("positive") + +# amount = int(input("Enter amount:")) +# discount = 0 +# if(amount>10000): +# discount = (amount * 20)/100 +# amount_to_pay = amount - discount +# print("Amount:",amount_to_pay) +# elif(amount>5000 and amount<=10000): +# discount = (amount * 10)/100 +# amount_to_pay = amount - discount +# print("Amount:",amount_to_pay) +# elif(amount>=1000 and amount <=5000): +# discount = (amount * 5)/100 +# amount_to_pay = amount - discount +# print("Amount:",amount_to_pay) +# elif(amount<1000): +# print("no discount") +# else: +# print("input is not valid") + +#nested if else +# num = int(input("Enter a number:")) +# if num >0: +# if num % 2 ==0: +# print(num," is even") +# else: +# print(num,"is odd") +# else: +# if num ==0: +# print(num,"is special") +# else: +# print(num,"is negative") + +# import time +# time = int(time.strftime("%H")) +# print(time) +# if (time>6 and time <12): +# print("Good Morning") +# elif time >=12 and time <=16: +# print("Good Midnoon") +# elif time >=16 and time <=20: +# print("Good Afternoon") +# else: +# print("Good night") + +# day = "Monday" +# match day: +# case "Sunday": +# print(f"Today is {day}") +# case "Monday": +# print(f"Today is {day}") +# case "Tuesday": +# print(f"Today is {day}") +# case _: +# print("Invalid day") + +# x = 100 +# match x: +# case if x!=10: +# print(x," is not 10") +# case (x==100): +# print(x," is 100") + From 92c4dcd4174d747967ac1d6f7348ec07e7a3edfd Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Tue, 26 Aug 2025 14:28:54 +0600 Subject: [PATCH 023/115] video 17 codes added --- video17.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 video17.py diff --git a/video17.py b/video17.py new file mode 100644 index 0000000..124d7b7 --- /dev/null +++ b/video17.py @@ -0,0 +1,26 @@ +# print("Loops") +# name = "Md Asif ul Haque" +# for x in name: +# print(x) + +# names = ["Asif","Emon","Hasan","Probin","Rohan"] +# for x in names: +# print(x) + +zen = ''' +Beautiful is better than ugly. +Explicit is better than implicit. +Simple is better than complex. +Complex is better than complicated. +''' +# numbers = (23,23,11,24,55,23,64,19) +# total = 0 +# for x in numbers: +# total += x + +# print(total) + +# numbers = [34,54,67,21,78,97,45,44,80,19] +# for x in numbers: +# if x%2==0: +# print(x) \ No newline at end of file From e49d9198e2787bd1ae2bb17f2451e767501011fc Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Tue, 26 Aug 2025 18:02:42 +0600 Subject: [PATCH 024/115] video 6 again added --- video6.py | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/video6.py b/video6.py index c53da50..394f3b9 100644 --- a/video6.py +++ b/video6.py @@ -36,3 +36,61 @@ # return c # print(sub()) + +#data types +#numeric - int,float,complex,bool +# var1 = 100 +# var2 = 23.45 +# var3 = True +# var4 = 3 + 4j + +#variable and data type revise + +name = "Hello Asif" +age = 24 +is_student = False +price = 39.99 +print(name,age,is_student,price) +# del age +# print (age) + +#local variables +# def sum(): +# a= 10 +# b = 20 +# print(a+b) +# sum() + +# print(a+b) + +# #global variable +# a = 20 +# b = 30 +# def multi(): +# c = a * b +# print(c) +# multi() + +# PI_VALUE = 3.14422314 + +#numeric data type +int_var = 23242 +float_var = 223.9838 +bool_var = True +complex_var = 3 + 4j +print(type(int_var)) +print(type(float_var)) +print(type(bool_var)) +print(type(complex_var)) + +str1 = 'Asif' +str2 = "Emon" +str3 = '''Probin''' +print(str1,type(str1)) +print(str2,type(str2)) +print(str3,type(str3)) + +l = [12,"Asif",True,23.99] +for x in l: + print(x) + From 38d277ddafa91252eb3e7559320cc90bd1d53748 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Tue, 26 Aug 2025 18:03:21 +0600 Subject: [PATCH 025/115] section 9 added --- section9.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 section9.py diff --git a/section9.py b/section9.py new file mode 100644 index 0000000..aa59d2e --- /dev/null +++ b/section9.py @@ -0,0 +1 @@ +print("Regular expressions") \ No newline at end of file From a441762f0bd71c81113a373b64555700ce40e5fa Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Wed, 27 Aug 2025 19:46:09 +0600 Subject: [PATCH 026/115] conditional practice added --- conditional.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 conditional.py diff --git a/conditional.py b/conditional.py new file mode 100644 index 0000000..351ad55 --- /dev/null +++ b/conditional.py @@ -0,0 +1,31 @@ +age = 16 +if age>18: + print("Eligible to vote") +else: + print("Not eligible to vote") + +#elif statement +age = 34 +if age <=10: + print("Child") +elif age <=18: + print("Teenager") +elif age <=25: + print("Young Adult") +else: + print("Adult") + +#nested if else +num = -4 +if num>0: + if num%2==0: + print("Even") + else: + print("Odd") +else: + if num==0: + print("Zero") + else: + print("Negative") + +#calcutor match program \ No newline at end of file From 6aacdb532c91d3fe86b0ed643e272204f079d013 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Wed, 27 Aug 2025 20:33:48 +0600 Subject: [PATCH 027/115] some more conditional codes added --- conditional.py | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/conditional.py b/conditional.py index 351ad55..900069d 100644 --- a/conditional.py +++ b/conditional.py @@ -28,4 +28,50 @@ else: print("Negative") -#calcutor match program \ No newline at end of file +#calcutor match program + +# num1 = int(input("Enter a number:")) +# num2 = int(input("Enter another number:")) +# op = input("Enter an operator:") +# match op: +# case "+": +# print(num1+num2) +# case "-": +# print(num1-num2) +# case "*": +# print(num1*num2) +# case "/": +# print(num1/num2) +# case _ : +# print("Operation invalid") + +age = 10 +member = True +if age > 18: + if member: + print("Ticket price in $12") + else: + print("Ticket price in $20") +else: + if member: + print("Ticket price is $8") + else: + print("Ticket price is $10") + +#if else in one line + +# x = 10 +# y = 5 +# res = "x is greater" if x > y else "y is greater" +# print(res) + +# budget = 60 +# price = 9.99 +# if budget >= 50 and price <=10: +# print("Buy 3 pieces") +# if budget >=100 and price <=20: +# print("Buy two pieces") + +# print("Asif" and 99) +# print("Asif" or 99) + From 53198bc11c34f4854ccbc7d7e3e11f672a8d23a5 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Wed, 27 Aug 2025 22:23:10 +0600 Subject: [PATCH 028/115] practice codes --- conditional.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/conditional.py b/conditional.py index 900069d..f595ee9 100644 --- a/conditional.py +++ b/conditional.py @@ -75,3 +75,44 @@ # print("Asif" and 99) # print("Asif" or 99) +#problem 1 +# j_angry = True +# s_angry = True +# if j_angry and s_angry: +# print("True") +# else: +# print("False") + +# if x % 2 ==0: +# return "Even" +# else: +# return "Odd" + + +# if "cat" in str: +# print("True") +# else: +# print("False")c +str = "bazingaa" + +# cat_num = 0 +# hat_num = 0 + +# if "cat" in str: +# cat_num+=1 +# if "hat" in str: +# hat_num=+1 + +# if cat_num == hat_num: +# print("True") +# else: +# print("False") + +def bigNumber(a): + if a >100: + print("Big") + else: + print("Number") + +a = int(input()) +bigNumber(a) \ No newline at end of file From e68e53f60d3fcee33ba4df8e6020e5977060bfed Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Thu, 28 Aug 2025 22:53:41 +0600 Subject: [PATCH 029/115] string from tutorialspoint added --- string_tutorial.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 string_tutorial.py diff --git a/string_tutorial.py b/string_tutorial.py new file mode 100644 index 0000000..69f24ab --- /dev/null +++ b/string_tutorial.py @@ -0,0 +1,8 @@ +print("String and methods - Tutorialspoint") + +str1 = 'Hi I am Python' +str2 = "I don't love Bangladesh" +str3 = '''I love Python''' +print(str1,type(str1)) +print(str2,type(str2)) +print(str3,type(str3)) \ No newline at end of file From ec767ac8ad990019bdf5a5bb9550a7a292e75574 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Fri, 29 Aug 2025 00:02:24 +0600 Subject: [PATCH 030/115] string codes --- string_tutorial.py | 51 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/string_tutorial.py b/string_tutorial.py index 69f24ab..56aacf4 100644 --- a/string_tutorial.py +++ b/string_tutorial.py @@ -3,6 +3,51 @@ str1 = 'Hi I am Python' str2 = "I don't love Bangladesh" str3 = '''I love Python''' -print(str1,type(str1)) -print(str2,type(str2)) -print(str3,type(str3)) \ No newline at end of file +# print(str1,type(str1)) +# print(str2,type(str2)) +# print(str3,type(str3)) + +# print(str1[0],str1[1]) +# print(str2[1],str2[4]) + +# for character in str1: +# print(character,end=" ") +# for x in str2: +# print(x,end='-') + +str1 = "Hello World!" +print(str1) +#escape characters +# print("I am 24 year\'s old") +# print("Hi i am Asif\nI am 24\nI live in Rajshahi") +# print("Tab will appear as \tinc") +# print("Backspace is \bii") + +#string slicing + +# print("length is :",len(var)) +# print(var[0]) +# print(var[11]) +# print(var[12]) +# print(var[len(var)-3]) +# print(var[len(var)-1]) +# print(var[len(var)-5]) +# print(var[len(var)-12]) + +# var = "Hello Python" +# print(var[1:5]) +# print(var[:8]) +# print(var[len(var)-9:len(var)-4]) + +#string modifying using a list +# str = "Hello Asif" +# l = list(str) +# print(l) + +# l[0] ="I" +# l[1] = " " +# l[2] = "a" +# l[3] ="m" +# print(l) +# s1 = str(l) +# print(s1) \ No newline at end of file From bd81e6c93c508b29b7da29016a24fc8214cb2768 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sat, 30 Aug 2025 12:01:53 +0600 Subject: [PATCH 031/115] string codes --- string_tutorial.py | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/string_tutorial.py b/string_tutorial.py index 56aacf4..de77228 100644 --- a/string_tutorial.py +++ b/string_tutorial.py @@ -50,4 +50,39 @@ # l[3] ="m" # print(l) # s1 = str(l) -# print(s1) \ No newline at end of file +# print(s1)\ + +# s1 = "WORD" +# print("Original string:",s1) +# li = list(s1) +# li.insert(3,"L") +# print(li) +# s1 ="" +# s2=s1.join(li) +# print(s2) + +# import array as ar +# s1 = + +#string concatenation +f_name = "Md Asif" +l_name = "ul Hauqe" +print(f_name+" "+l_name) + +str1 = "abc" +print(str1*10) +# print("Asif"+23) + +str1 ="Hello" +str2 = "World" +str3 = str1+" "+str2 +print(str3) + +#string repetition +h1 = "Hello" +print(h1 *3 ) + +s1 = "I love" +s2 = "Python" +concat = s1 + " " + s2 +print(concat * 3) \ No newline at end of file From c7e4ffb8792d4e63185eb6156a4f78533d925edb Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sat, 30 Aug 2025 12:02:28 +0600 Subject: [PATCH 032/115] error handling codes --- error_handling.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 error_handling.py diff --git a/error_handling.py b/error_handling.py new file mode 100644 index 0000000..218ac67 --- /dev/null +++ b/error_handling.py @@ -0,0 +1,18 @@ +print("Error handling") +# num1 = 100 +# num2 = 0 +# div = num1/num2 +# print("some important line of code") +# print("nfjanfaj") +# num = 10 +# print num + +# ab +# if a +# print(a) + +# print(1 + 'a') +# d = {"key1":"value1"} +# d["key2"] + +# import mat \ No newline at end of file From 91cc1ac65cbbe5c2988999a6a85ee4fdd6609d3f Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sat, 30 Aug 2025 12:02:56 +0600 Subject: [PATCH 033/115] oop codes --- OOP.py | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/OOP.py b/OOP.py index 617f0b6..353c9c2 100644 --- a/OOP.py +++ b/OOP.py @@ -38,15 +38,37 @@ # s1 = Student() # print(id(s1)) -class Student: - def __init__(self,name,id,profession): - self.name = name - self.id = id - self.is_student = profession - print("Object is created") - print(f"name is {self.name} id is {self.id} profession is {self.is_student}") +# class Student: +# def __init__(self,name,id,profession): +# self.name = name +# self.id = id +# self.is_student = profession +# print("Object is created") +# print(f"name is {self.name} id is {self.id} profession is {self.is_student}") + +# s1 = Student("Asif",2323,"Student") +# s2 = Student("Arfi",3433,"Baby") +# print(s1.name,s1.id,s1.is_student) +# print(s2.name,s2.id,s2.is_student) + +# class Car: +# def __init__(self,name,color,seat): +# self.color = color +# self.brand = name +# self.seats = seat +# print(f"The car brand: {self.brand} color is :{self.color} seats : {self.seats} ") + +# BMW = Car("BMW","black",2) +# Audi = Car("Audi","White",4) + +# class ComplexNumber: +# def __init__(self,real,imaginary): +# self.real = complex(real) +# self.imaginary = complex(imaginary) +# # print(f"{int(self.real)} + {int(self.imaginary)}j") +# print(self.real + self.imaginary) +# def addition(self): +# print() -s1 = Student("Asif",2323,"Student") -s2 = Student("Arfi",3433,"Baby") -print(s1.name,s1.id,s1.is_student) -print(s2.name,s2.id,s2.is_student) \ No newline at end of file +# num1 = ComplexNumber(3,5) +# print(type(num1)) From 8bc58e3525786e1cafc30b52fa158f381c528298 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sat, 30 Aug 2025 12:03:24 +0600 Subject: [PATCH 034/115] introduction codes --- introduction.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 introduction.py diff --git a/introduction.py b/introduction.py new file mode 100644 index 0000000..8e23576 --- /dev/null +++ b/introduction.py @@ -0,0 +1 @@ +print("Hello World") \ No newline at end of file From 81ddd6890dc8147150aeac64726c96f7dc7f90b6 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sat, 30 Aug 2025 12:03:55 +0600 Subject: [PATCH 035/115] working tree clean --- .idea/misc.xml | 3 +++ video17.py | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index c2837db..4538830 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,7 @@ + + \ No newline at end of file diff --git a/video17.py b/video17.py index 124d7b7..31fd45b 100644 --- a/video17.py +++ b/video17.py @@ -23,4 +23,21 @@ # numbers = [34,54,67,21,78,97,45,44,80,19] # for x in numbers: # if x%2==0: -# print(x) \ No newline at end of file +# print(x) + +# for i in range(0,5,1): +# print(i) +# for num in range(10): +# print(num, end=" ") + +# for num in range(10,20): +# print(num, end=" ") + +# for num in range(1,10,2): +# print(num,end="-") + +# dic = {"name":"Asif","age":24,"is_student":False} +# for key in dic: +# print(key,":",dic[key]) + +#for else loop From 37c8ea4f892665bdc5785d697f71961e12b9ebbf Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sat, 30 Aug 2025 17:37:32 +0600 Subject: [PATCH 036/115] loops from tutorialspoint added --- loop_tut_point.py | 73 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 loop_tut_point.py diff --git a/loop_tut_point.py b/loop_tut_point.py new file mode 100644 index 0000000..ec72345 --- /dev/null +++ b/loop_tut_point.py @@ -0,0 +1,73 @@ +print("Hello Loops from tutorialspoint") +#3 types - while,for,nested +# li = [12,34,21,22,1] +# for x in li: +# print(x) + +# str ="Hello Python From Tutorialspoint" +# for x in str: +# print(x,end=" ") + +zen = ''' +Beautiful is better than ugly. +Explicit is better than implicit. +Simple is better than complex. +Complex is better than complicated. +''' +# for char in zen: +# if char is not 'aeiou': +# print(char,end=' ') + +# numbers = (12,34,22,11,98) +# total=0 +# for x in numbers: +# total+=x + +# print("Sum is:",total) + +# li = [12,23,11,34,22,77,42] +# for x in li: +# if x%2==1: +# print(x,end='-') + +# for i in range(1,10,1): +# print(i) + +# for i in range(0,20,2): +# print(i) + +# for i in range(5): +# print(i,end=" ") +# print() +# for i in range(10,20): +# print(i,end=" ") +# print() +# for i in range(1,10,2): +# print(i,end=" ") + +#loop with dictonaries +dic = {"name":"Md Asif","age":24,"is_student":True} +# for x in dic: +# print(x) + +# for key in dic: +# for value in dic: +# print(key[value]) +# for x in dic: +# print("keys are:",x) +# print("values are:",dic[x]) + +# for key in dic: +# print(key,":",dic[key]) + +#check prime number +for num in range(20,40): + for i in range(2,num): + if num%i==0: + j = num/i + print("%d equals to %d * %d" %(num,i,j)) + break + else: + print("%d is a prime number" %(num)) + break + \ No newline at end of file From ad75be9b5d447b8931f8fbdf147669f52b2442dc Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sat, 30 Aug 2025 21:49:00 +0600 Subject: [PATCH 037/115] added codes --- loop_tut_point.py | 63 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/loop_tut_point.py b/loop_tut_point.py index ec72345..c5cb537 100644 --- a/loop_tut_point.py +++ b/loop_tut_point.py @@ -61,13 +61,56 @@ # print(key,":",dic[key]) #check prime number -for num in range(20,40): - for i in range(2,num): - if num%i==0: - j = num/i - print("%d equals to %d * %d" %(num,i,j)) - break - else: - print("%d is a prime number" %(num)) - break - \ No newline at end of file +# for num in range(20,40): +# for i in range(2,num): +# if num%i==0: +# j = num/i +# print("%d equals to %d * %d" %(num,i,j)) +# break +# else: +# print("%d is a prime number" %(num)) +# break + +#for else loop +# for i in range(0,10): +# print(i,end=" ") +# else: +# print("else block started") + +# li = [3,4,-3,2,-2] +# for i in range(len(li)): +# # print(li[i]) +# if li[i] >=0: +# print("Positive number") +# else: +# print("Negative Number") +# i=0 +# while i<=10: +# print("iteration no {}".format(i)) +# i+=1 + +# var = "0" +# while var.isnumeric() ==True: + +#break statement +# for letter in "Python": +# if letter=='o': +# break +# print(letter) +# var = 10 +# while var>0: +# if var==5: +# break +# print(var) +# var=var -1 + +# no = 23 +# numbers =[21,11,22,24,23,41,2] +# for x in numbers: +# if x ==no: +# print("Found") +# break +# else: +# print("Not found") + +#continue statement From 75ff05190caf3adb157f9a3c2f54910d7b055d2e Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Mon, 1 Sep 2025 03:03:04 +0600 Subject: [PATCH 038/115] OOP revise --- OOP.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/OOP.py b/OOP.py index 353c9c2..2513771 100644 --- a/OOP.py +++ b/OOP.py @@ -72,3 +72,56 @@ # num1 = ComplexNumber(3,5) # print(type(num1)) + +#OOP revise +# seller1_name = "Md Asif" +# seller1_address = "Rajshahi" +# seller1_money = 234 + +# seller2_name = "Emon" +# seller2_address = "Kushtia" +# seller2_money = 433 + +# print(type(233)) +# print(type(23.34)) +# print(type(True)) +# print(type([23,22,1,2])) +# print(type((2,33,22)) +# print(type({"name":"Asif"})) + +# class Car: +# pass + +# BMW = Car() +# print(BMW) + +# class Student: +# def __init__(self): +# self.name = "Asif" +# self.id = 2323 +# # print(id(arg)) +# print("Student object created") + +# s1 = Student() +# print(s1.name,s1.id) + +# class Car: +# def __init__(self): +# self.name = "BMW" +# self.model = "X4" +# self.seats = 4 +# print(f"{self.name}:{self.model} and {self.seats} seaters") + +# bmw_obj = Car() +# # print(bmw_obj) +# audi_obj = Car() + +class Car: + def __init__(self,name,model,seat): + self.company_name = name + self.car_model = model + self.seats = seat + print(f"{self.company_name}:{self.car_model} and {self.seats} seater") + +bmw = Car("BMW",'X6',5) +audi = Car("Audi",'R8',2) \ No newline at end of file From e2b06450281aa9efdd41b6c39c4714aa4e8dd6df Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Mon, 1 Sep 2025 03:45:20 +0600 Subject: [PATCH 039/115] list codes added --- list_tut_point.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 list_tut_point.py diff --git a/list_tut_point.py b/list_tut_point.py new file mode 100644 index 0000000..e360b9d --- /dev/null +++ b/list_tut_point.py @@ -0,0 +1,47 @@ +print("Everything about list from Tutorialspoint") + +# list1 = [12,32,1,2,3,4] +# list2 = ["Asif",True,23.45,2+3j] +# print(list1,list2) + +# print(list1[0]) +# print(list1[2]) +# print(list2[3]) + +# list1[0] = 100 +# list1[1] = 50 +# print(list1) + +# list2[0] ="Emon" +# list2[3] = 3+4j +# print(list2) + +# del list2[0] +# del list2[1] +# print(list2) + +# #list concatenation(+) +# l1 = [1,2,3] +# l2 = [4,5,6] +# l3 = l1 + l2 +# print(l3) + +# #list repitition +# l1 = [12,23] +# print(l1*4) + +# print(3 in [1,3,4]) + +#accessing list iteams +l1 = ["a","b","c","d","e"] +print(l1[len(l1)-3]) +print(l1[-2]) + +#slie operator +print(l1[1:3]) +l2 = [12,23,22,11,44,24,4] +print(l2[0:5:2]) +print(l2[1:3]) + +#change list + From 701566c49667f912a243efa258f067b248b606e9 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Mon, 1 Sep 2025 04:31:36 +0600 Subject: [PATCH 040/115] list codes added --- list_tut_point.py | 45 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/list_tut_point.py b/list_tut_point.py index e360b9d..29166e9 100644 --- a/list_tut_point.py +++ b/list_tut_point.py @@ -33,15 +33,44 @@ # print(3 in [1,3,4]) #accessing list iteams -l1 = ["a","b","c","d","e"] -print(l1[len(l1)-3]) -print(l1[-2]) +# l1 = ["a","b","c","d","e"] +# print(l1[len(l1)-3]) +# print(l1[-2]) + +# #slie operator +# print(l1[1:3]) -#slie operator -print(l1[1:3]) -l2 = [12,23,22,11,44,24,4] -print(l2[0:5:2]) -print(l2[1:3]) +# print(l2[0:5:2]) +# print(l2[1:3]) #change list +# l2 = [12,23,22,11,44,24,4] +# l3 = [100,200,300] +# l2[0:3]=l3 +# print(l2) + +l1 = ["a","b","c","d","e"] +l2 = [2,4,5] +# l1[0:4]=l2 +# print(l1) +l1[1:3]=l2 +print(l1) + +#adding a element in last +fruits = ["Apple","Banana","Mango","Date"] +fruits.append("Watermelon") +print(fruits) + +fruits.insert(0,"Dragon Fruit") +fruits.insert(3,"Berry") +print(fruits) + +id = [2323,1232,4231] +names =["Asif","Probin","Emon"] +id.extend(names) +print(id) +list1 = [1,2,3,4,5] +list2 = [10,20,30,40] +list1.extend(list2) +print(list1) From 8446033476dc62319e99e7d597078a853bb534e2 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Tue, 2 Sep 2025 19:40:35 +0600 Subject: [PATCH 041/115] tuple codes added --- File Handling/file_handling.py | 0 OOP.py | 17 ++++--- Tuple.py | 42 ++++++++++++++++ list_tut_point.py | 91 +++++++++++++++++++++++++--------- string_tutorial.py | 82 ++++++++++++++++++++++-------- 5 files changed, 179 insertions(+), 53 deletions(-) create mode 100644 File Handling/file_handling.py create mode 100644 Tuple.py diff --git a/File Handling/file_handling.py b/File Handling/file_handling.py new file mode 100644 index 0000000..e69de29 diff --git a/OOP.py b/OOP.py index 2513771..0a967d9 100644 --- a/OOP.py +++ b/OOP.py @@ -116,12 +116,13 @@ # # print(bmw_obj) # audi_obj = Car() -class Car: - def __init__(self,name,model,seat): - self.company_name = name - self.car_model = model - self.seats = seat - print(f"{self.company_name}:{self.car_model} and {self.seats} seater") +# class Car: +# def __init__(self,name,model,seat): +# self.company_name = name +# self.car_model = model +# self.seats = seat +# print(f"{self.company_name}:{self.car_model} and {self.seats} seater") -bmw = Car("BMW",'X6',5) -audi = Car("Audi",'R8',2) \ No newline at end of file +# bmw = Car("BMW",'X6',5) +# audi = Car("Audi",'R8',2) + diff --git a/Tuple.py b/Tuple.py new file mode 100644 index 0000000..4b4ed6b --- /dev/null +++ b/Tuple.py @@ -0,0 +1,42 @@ +print("Tuple From Tutorialspoint)") +tup1 = (12,32,31,23,11) +tup2 = ("Asif",24,True,3+4j) +print(tup1,type(tup1)) +print(tup2,type(tup2)) +empty_tup =() +print(empty_tup,type(empty_tup)) + +tup3 = (23,) +print(tup3,type(tup3)) + +#accessing tuple values +print(tup1[0],tup1[1]) +print(tup2[1:4]) + +#tuple is immutable - cannot change particular values +tup1 = (1,2,3) +tup2 = ("a","b","c") +# tup1[0] =23 +tup3 = tup1 + tup2 +print(tup3) +tup4 = tup1[0:2] +print(tup4) + +#delete tuple +# del tup1 +# print(tup1) + +#tuple concatenation +tup1 = (12,34,22,1) +tup2 = ("abc","cde","efg") +tup3 = tup2 + tup1 +print(tup3) + +#tuple repitition +tup1 = (12,22,11) +tup2 = tup1 * 4 +print(tup2) + +print(12 in tup1) +tup4 = ("Abc",) +print(tup4,type(tup4)) \ No newline at end of file diff --git a/list_tut_point.py b/list_tut_point.py index 29166e9..4d549ee 100644 --- a/list_tut_point.py +++ b/list_tut_point.py @@ -49,28 +49,71 @@ # l2[0:3]=l3 # print(l2) -l1 = ["a","b","c","d","e"] -l2 = [2,4,5] -# l1[0:4]=l2 +# l1 = ["a","b","c","d","e"] +# l2 = [2,4,5] +# # l1[0:4]=l2 +# # print(l1) +# l1[1:3]=l2 +# print(l1) + +# #adding a element in last +# fruits = ["Apple","Banana","Mango","Date"] +# fruits.append("Watermelon") +# print(fruits) + +# fruits.insert(0,"Dragon Fruit") +# fruits.insert(3,"Berry") +# print(fruits) + +# id = [2323,1232,4231] +# names =["Asif","Probin","Emon"] +# id.extend(names) +# print(id) + +# list1 = [1,2,3,4,5] +# list2 = [10,20,30,40] +# list1.extend(list2) +# print(list1) + +# l1 = [1,2,3,4,5] +# l1.remove(3) +# print(l1) +# l1 = [1,3,3,2,1] +# l1.remove(3) +# print(l1) + +# l1 = [23,34,22,11,2] +# # print(l1.pop()) +# # print(l1) +# l1.pop(2) +# print(l1) + +# l2 = ["Urmi","Monika","Sadia","Mow"] +# # l2.pop() +# # print(l2) +# l2.pop(1) +# print(l2) +# l2.clear() +# print(l2) +# l1.clear() # print(l1) -l1[1:3]=l2 -print(l1) - -#adding a element in last -fruits = ["Apple","Banana","Mango","Date"] -fruits.append("Watermelon") -print(fruits) - -fruits.insert(0,"Dragon Fruit") -fruits.insert(3,"Berry") -print(fruits) - -id = [2323,1232,4231] -names =["Asif","Probin","Emon"] -id.extend(names) -print(id) - -list1 = [1,2,3,4,5] -list2 = [10,20,30,40] -list1.extend(list2) -print(list1) + +# l2 = [12,232,23,112,23,2] +# del l2[0] +# del l2[3] +# print(l2) + +# l2 = ["Asif",True,23.44,2+3j] +# del l2[0:2] +# print(l2) + +list1 = [23,22,"Asif",True,4.99] +for item in list1: + print(item,end=' ') + +index = 0 +while index < len(list1): + print(list1[index]) + index = index + 1 + + \ No newline at end of file diff --git a/string_tutorial.py b/string_tutorial.py index de77228..6fad64c 100644 --- a/string_tutorial.py +++ b/string_tutorial.py @@ -65,24 +65,64 @@ # s1 = #string concatenation -f_name = "Md Asif" -l_name = "ul Hauqe" -print(f_name+" "+l_name) - -str1 = "abc" -print(str1*10) -# print("Asif"+23) - -str1 ="Hello" -str2 = "World" -str3 = str1+" "+str2 -print(str3) - -#string repetition -h1 = "Hello" -print(h1 *3 ) - -s1 = "I love" -s2 = "Python" -concat = s1 + " " + s2 -print(concat * 3) \ No newline at end of file +# f_name = "Md Asif" +# l_name = "ul Hauqe" +# print(f_name+" "+l_name) + +# str1 = "abc" +# print(str1*10) +# # print("Asif"+23) + +# str1 ="Hello" +# str2 = "World" +# str3 = str1+" "+str2 +# print(str3) + +# #string repetition +# h1 = "Hello" +# print(h1 *3 ) + +# s1 = "I love" +# s2 = "Python" +# concat = s1 + " " + s2 +# print(concat * 3) + +#string revise +str1 = 'Hi i am Python' +str2 = "Hello Bro" +str3 = '''Good Morning''' + +print(str1[0]) +print(str2[0]) +print(str3[3]) + +# str[0] = "I" +# str1 = "str1 updated" +# print(str1) + +# #escape characters +# print("Multiline\nI am 24 year\'s old\n\"I am a student\"") + +#string slicing +str = "Hello Python" +# s1 = str[:] +# print(s1) +# s1 = str[0:5] +# print(s1) +# print(str[len(str)-1:len(str)-4]) +# print(str[1:10:2]) +# print(str[10:2]) +# print(str[-8:-3]) +#string modification +str = "I want to go to America" +str_li = list(str) +# print(str_li) +str_li[0] ="H" +str_li[1] ="e" +str="".join(str_li) +print(str) + +import array as ar +s1 = "Hello Bangladesh" +sar =ar.array('u',s1) +print(sar) \ No newline at end of file From 414fa2dbf19ca0c5f6fe2fa226743e0b98cd3c5a Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Wed, 3 Sep 2025 04:00:13 +0600 Subject: [PATCH 042/115] random codes updated --- File Handling/file_handling.py | 21 ++++++++ Tuple.py | 98 ++++++++++++++++++++-------------- video17.py | 2 - 3 files changed, 78 insertions(+), 43 deletions(-) diff --git a/File Handling/file_handling.py b/File Handling/file_handling.py index e69de29..93d00df 100644 --- a/File Handling/file_handling.py +++ b/File Handling/file_handling.py @@ -0,0 +1,21 @@ +# f = open('sample.txt','w') +# f.write("Hello File handling") +# f.close() + +# f = open('./File Handling/sample.txt',"w") +# f.write("Hello World") +# f.write("\nI am learning Python") +# f.close() + +#creating a new file +# f = open('./File Handling/text_file1','w') +# f.write("Hi I am a sample text file") +# f.close() + +#writing in a existing file +f1 = open('./File Handling/text_file1','w') +f1.write("Hello I am Python") +f1.write("\nI am 34 years old") +f1.close() + +#writing in existing file delets before existing file diff --git a/Tuple.py b/Tuple.py index 4b4ed6b..d5dfd25 100644 --- a/Tuple.py +++ b/Tuple.py @@ -1,42 +1,58 @@ print("Tuple From Tutorialspoint)") -tup1 = (12,32,31,23,11) -tup2 = ("Asif",24,True,3+4j) -print(tup1,type(tup1)) -print(tup2,type(tup2)) -empty_tup =() -print(empty_tup,type(empty_tup)) - -tup3 = (23,) -print(tup3,type(tup3)) - -#accessing tuple values -print(tup1[0],tup1[1]) -print(tup2[1:4]) - -#tuple is immutable - cannot change particular values -tup1 = (1,2,3) -tup2 = ("a","b","c") -# tup1[0] =23 -tup3 = tup1 + tup2 -print(tup3) -tup4 = tup1[0:2] -print(tup4) - -#delete tuple -# del tup1 -# print(tup1) - -#tuple concatenation -tup1 = (12,34,22,1) -tup2 = ("abc","cde","efg") -tup3 = tup2 + tup1 -print(tup3) - -#tuple repitition -tup1 = (12,22,11) -tup2 = tup1 * 4 -print(tup2) - -print(12 in tup1) -tup4 = ("Abc",) -print(tup4,type(tup4)) \ No newline at end of file +# tup1 = (12,32,31,23,11) +# tup2 = ("Asif",24,True,3+4j) +# print(tup1,type(tup1)) +# print(tup2,type(tup2)) +# empty_tup =() +# print(empty_tup,type(empty_tup)) + +# tup3 = (23,) +# print(tup3,type(tup3)) + +# #accessing tuple values +# print(tup1[0],tup1[1]) +# print(tup2[1:4]) + +# #tuple is immutable - cannot change particular values +# tup1 = (1,2,3) +# tup2 = ("a","b","c") +# # tup1[0] =23 +# tup3 = tup1 + tup2 +# print(tup3) +# tup4 = tup1[0:2] +# print(tup4) + +# #delete tuple +# # del tup1 +# # print(tup1) + +# #tuple concatenation +# tup1 = (12,34,22,1) +# tup2 = ("abc","cde","efg") +# tup3 = tup2 + tup1 +# print(tup3) + +# #tuple repitition +# tup1 = (12,22,11) +# tup2 = tup1 * 4 +# print(tup2) + +# print(12 in tup1) +# tup4 = ("Abc",) +# print(tup4,type(tup4)) + +# #accessing tuples - index,slicing +# numbers = (12,22,"Abc","bcd") +# print(numbers[3]) +# print(numbers[len(numbers)-3]) + +# tup1 =(12,32,1,1,332,323,2,3,34,2) +# tup2 = tup1[2:-1] +# print(tup2) +#tuple slicing +# t1 =(10,20,30,40) +# t2 =("one","two","three","four") +# t3 =(True,False) +# t4 = t1+t2+t3 +# print(t4) + diff --git a/video17.py b/video17.py index 31fd45b..2f44727 100644 --- a/video17.py +++ b/video17.py @@ -39,5 +39,3 @@ # dic = {"name":"Asif","age":24,"is_student":False} # for key in dic: # print(key,":",dic[key]) - -#for else loop From 4d0474d6fb9b7cf6aa72ebce8bdfb093c9260bf9 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Wed, 3 Sep 2025 04:02:00 +0600 Subject: [PATCH 043/115] random codes --- Atm_oop.py | 0 File Handling/sample.txt | 2 ++ File Handling/text_file1 | 2 ++ coordinate_geometry.py | 59 ++++++++++++++++++++++++++++++++++++++++ fraction.py | 0 5 files changed, 63 insertions(+) create mode 100644 Atm_oop.py create mode 100644 File Handling/sample.txt create mode 100644 File Handling/text_file1 create mode 100644 coordinate_geometry.py create mode 100644 fraction.py diff --git a/Atm_oop.py b/Atm_oop.py new file mode 100644 index 0000000..e69de29 diff --git a/File Handling/sample.txt b/File Handling/sample.txt new file mode 100644 index 0000000..7ba98ff --- /dev/null +++ b/File Handling/sample.txt @@ -0,0 +1,2 @@ +Hello World +I am learning Python \ No newline at end of file diff --git a/File Handling/text_file1 b/File Handling/text_file1 new file mode 100644 index 0000000..912a420 --- /dev/null +++ b/File Handling/text_file1 @@ -0,0 +1,2 @@ +Hello I am Python +I am 34 years old \ No newline at end of file diff --git a/coordinate_geometry.py b/coordinate_geometry.py new file mode 100644 index 0000000..1b0949d --- /dev/null +++ b/coordinate_geometry.py @@ -0,0 +1,59 @@ +class Point: + def __init__(self,x,y): + self.x_cod = x + self.y_cod = y + + def __str__(self): + return '<{},{}>'.format(self.x_cod,self.y_cod) + + + def euclidean_distance(self,other): + x = (self.x_cod - other.x_cod)**2 + y = (self.y_cod - other.y_cod)**2 + return ((x+y)**0.5) + + def distance_from_origin(self): + x = self.x_cod**2 + y = self.y_cod **2 + distance = (x+y)**0.5 + return distance + ## return self.euclidean_distance(self,Point(0,0)) + +class Line: + def __init__(self,A,B,C): + self.a = A + self.b = B + self.c = C + + def __str__(self): + return '{}x + {}y + {}'.format(self.a,self.b,self.c) + + def point_on_line(line,point): + lhs = line.a * point.x_cod + line.b * point.y_cod + line.c + if lhs == 0: + return "Point lies on the line" + else: + return "Does not lies on the line" + + def distance_from_line(line,point): + x = abs(line.a * point.x_cod + line.b * point.y_cod + line.c) + y = (line.a**2 + line.b**2)**0.5 + return x/y + +# l1 = Line(1,1,-2) +# print(l1) + +# p1 = Point(1,2) +# # p2 = Point(7,8) +# print(p1) + +# print(l1.point_on_line(p1)) #l1 is 1st argument and p1 is 2nd argument + +# # print(p1.euclidean_distance(p2)) +# print(p1.distance_from_origin()) + +#if two classes /objects are in the + +l1 = Line(1,1,-2) +p1 = Point(1,1) +print(l1.distance_from_line(p1)) \ No newline at end of file diff --git a/fraction.py b/fraction.py new file mode 100644 index 0000000..e69de29 From c218c6807b478f092067c3c6c35e35b4156c34f9 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Wed, 3 Sep 2025 09:51:17 +0600 Subject: [PATCH 044/115] function codes added --- function_practice.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 function_practice.py diff --git a/function_practice.py b/function_practice.py new file mode 100644 index 0000000..02098b2 --- /dev/null +++ b/function_practice.py @@ -0,0 +1,24 @@ +def is_even(num): + """ + This fn return if a given number is odd or even + input - any valid integer + output -odd/even + created on - 3 August 2025 + """ + if type(num) == int: + if num % 2 ==0: + return "Even" + else: + return "Odd" + else: + print("This is not available") + +print(is_even("asif")) + +# for i in range(1,11): +# x = is_even(i) +# print(x) + +def power(a=1,b=1): + return a**b +print(power(2)) \ No newline at end of file From 7e99de8c5f15446e7327ed1e925d754c123a6622 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Thu, 4 Sep 2025 19:08:05 +0600 Subject: [PATCH 045/115] some codes added --- OOP/oop_1.py | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 OOP/oop_1.py diff --git a/OOP/oop_1.py b/OOP/oop_1.py new file mode 100644 index 0000000..ee542de --- /dev/null +++ b/OOP/oop_1.py @@ -0,0 +1,59 @@ +# class Car: +# pass + +# audi = Car() +# print(audi) + +class Atm: + def __init__(self): + self.pin ='' + self.balance = 0 + self.menu() + # print(f"pin is {self.pin} and balance is {self.balance}") + + def menu(self): + user_input = input(""" + Hi + What you want to do? + 1.press 1 to create pin + 2.press 2 to change pin + 3.press 3 to check balance + 4.press 4 to withdraw balance + 5.press 5 to exit + """) + if user_input == '1': + self.create_pin() + elif user_input == '2': + self.change_pin() + elif user_input == '3': + self.check_balance() + + + def create_pin(self): + user_input =input("Enter a pin:") + self.pin = user_input + user_balance = int(input("Enter your balance:")) + self.balance = user_balance + print("Pin created successfully") + self.menu() + + def change_pin(self): + pin = input("Enter your pin:") + if self.pin == pin: + new_pin = input("Enter new pin:") + self.pin = new_pin + print("Pin updated successfully") + else: + print("Wrong Pin") + self.menu() + + def check_balance(self): + pin = input("Enter your pin:") + if self.pin == pin: + + + + +obj = Atm() + + \ No newline at end of file From 3b90e4d5eaeb49f028ba0e83deb236b7949df7f8 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Thu, 4 Sep 2025 19:08:39 +0600 Subject: [PATCH 046/115] some --- __pycache__/string.cpython-313.pyc | Bin 0 -> 340 bytes dsmp_campusx/session1.py | 45 +++++++++++++++++++++++++++++ rest_api.py | 8 +++++ string.py => string_py.py | 0 4 files changed, 53 insertions(+) create mode 100644 __pycache__/string.cpython-313.pyc create mode 100644 dsmp_campusx/session1.py create mode 100644 rest_api.py rename string.py => string_py.py (100%) diff --git a/__pycache__/string.cpython-313.pyc b/__pycache__/string.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..46eba54bc46bf39462325eec9c0274dd0cdd0e8c GIT binary patch literal 340 zcmey&%ge<81n%mSGLCRCFgylvV1OCQ_^bnDOl62+P+|yXFlB^@Dlh~y7BL1h6)^=f z7cqm`%s@6v5pz1LCR>$ca7j^SUb;eJUWx*gnVVXYk)Kjr#p98hlasFyPzmJbRS7_N zPKkNxIf*H$#TiwcP?4hiDqc^8ocyv>s9HZwmRqa^Kx0d8u@sjS8G=b8FloG!;WNlx zx6G5RVnT~ki;80si!;-5@^g~&Q&Nj!{PR*>iZaVmV_Z^;vrF;|Vge#VJpBD)fW`n_ zsaH^Wi^C>2KczG$)vkyWXb#Ae#d<*E12ZEd<4p$E3v7y47?f_Xi#D*_V3!0DVht=G VbQm~*)D3na5FypbQp66_0sy=OU?%_o literal 0 HcmV?d00001 diff --git a/dsmp_campusx/session1.py b/dsmp_campusx/session1.py new file mode 100644 index 0000000..4b5f37c --- /dev/null +++ b/dsmp_campusx/session1.py @@ -0,0 +1,45 @@ +print("Data Science Mentorship Program - Class 1") + +# print("Hello Bro",23,12.33) +# print(12,22,sep='') +# print("Asif",23,end='-') + +# print("Asif","Emon","Hasan",sep='-',end='\'') + +#data types +# import sys +# int_var = 23211 +# float_var = 23.22312 +# bool_var = True +# print(sys.getsizeof(int_var),sys.getsizeof(float_var)) + +# li = [12,"Asif",True,23.99] +# tu = (23,12,"Emon",False) +# str1 ="Hello Python" + +# print(int_var,type(int_var)) +# print(float_var,type(float_var)) +# print(bool_var,type(bool_var)) +# print(li,type(li)) +# print(tu,type(tu)) +# print(str1,type(str1)) + +# set1 ={23,22,11,22,43} +# dict1 = {"name":"Asif","age":24} +# null = None +# print(set1,type(set1)) +# print(dict1,type(dict1)) +# print(null,type(null)) + +a = 323 +print(a) +a ="Asif" +print(a) + +a,b,c = 12,"Asif",24 +p=q=r =45 + +num1 = int(input("Enter a number:")) +num2 = int(input("Enter another number:")) +sub = num1 - num2 +print(sub) \ No newline at end of file diff --git a/rest_api.py b/rest_api.py new file mode 100644 index 0000000..5f700d7 --- /dev/null +++ b/rest_api.py @@ -0,0 +1,8 @@ +import requests +import json + +url ="https://api.stackexchange.com/2.3/posts?order=desc&sort=activity&site=stackoverflow" +response = requests.get(url) +if response.status_code == 200: + data = response.json()['items'] + print(data) \ No newline at end of file diff --git a/string.py b/string_py.py similarity index 100% rename from string.py rename to string_py.py From 71fbcdef17df4c1d5800e31ca18a8588da86754f Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Thu, 4 Sep 2025 19:23:16 +0600 Subject: [PATCH 047/115] session 1 half tasks added --- dsmp_campusx/session1.py | 25 +++++++++-------- dsmp_campusx/session1_tasks.py | 51 ++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 12 deletions(-) create mode 100644 dsmp_campusx/session1_tasks.py diff --git a/dsmp_campusx/session1.py b/dsmp_campusx/session1.py index 4b5f37c..3ea046c 100644 --- a/dsmp_campusx/session1.py +++ b/dsmp_campusx/session1.py @@ -31,15 +31,16 @@ # print(dict1,type(dict1)) # print(null,type(null)) -a = 323 -print(a) -a ="Asif" -print(a) - -a,b,c = 12,"Asif",24 -p=q=r =45 - -num1 = int(input("Enter a number:")) -num2 = int(input("Enter another number:")) -sub = num1 - num2 -print(sub) \ No newline at end of file +# a = 323 +# print(a) +# a ="Asif" +# print(a) + +# a,b,c = 12,"Asif",24 +# p=q=r =45 + +# num1 = int(input("Enter a number:")) +# num2 = int(input("Enter another number:")) +# sub = num1 - num2 +# print(sub) + diff --git a/dsmp_campusx/session1_tasks.py b/dsmp_campusx/session1_tasks.py new file mode 100644 index 0000000..fb1df90 --- /dev/null +++ b/dsmp_campusx/session1_tasks.py @@ -0,0 +1,51 @@ +# Q1 :- Print the given strings as per stated format. +# Given strings: + +# "Data" "Science" "Mentorship" "Program" +# "By" "CampusX" + +print("Data","Science","Mentorship","Program","Started","By","CampusX",sep="-",end='') + +# Q2:- Write a program that will convert celsius value to fahrenheit. +# Write your code here +# celcius = int(input("Enter celcius value:")) +# farenheit = ((9/5)*celcius)+32 +# print("Temerature in fahrenheit:",farenheit) + +# Q3:- Take 2 numbers as input from the user.Write a program to swap the numbers without using any special python syntax. +# Write your code here +#input from users +# num1 = int(input("Enter a number:")) +# num2 = int(input("Enter another number:")) +# #swap the numbers +# temp = num1 +# num1 = num2 +# num2 = temp +# #print the numbers +# print("After swapping:",num1,num2) + + +# Q4:- Write a program to find the euclidean distance between two coordinates.Take both the coordinates from the user as input. +# Write your code here +#input from user +# x1 = int(input("Enter x1:")) +# y1 = int(input("Enter y1:")) +# x2 = int(input("Enter x2:")) +# y2 = int(input("Enter y2:")) +# #calculating the distance +# distance = ((x1-x2)**2 + (y1-y2)**2)**0.5 +# #printing the value +# print("Distance:",distance) + +# Q5:- Write a program to find the simple interest when the value of principle,rate of interest and time period is provided by the user. + +#input from user +# p = int(input("Enter principle value:")) +# r = float(input("Interest rate:")) +# t = int(input("Enter time period:")) +# #calculate the interest +# interest = (p * r * t)/100 +# #print the value +# print("interest is:",interest) + + From 41f3a496ca8b21229d975cc476b05bb8a40c6a16 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Thu, 4 Sep 2025 20:50:20 +0600 Subject: [PATCH 048/115] session 1 practice completed --- dsmp_campusx/session1.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/dsmp_campusx/session1.py b/dsmp_campusx/session1.py index 3ea046c..0b44f29 100644 --- a/dsmp_campusx/session1.py +++ b/dsmp_campusx/session1.py @@ -44,3 +44,41 @@ # sub = num1 - num2 # print(sub) +#type conversion +# var1 = "23" +# print(int(var1)) +# print(10+10.5) + +# print(int('24')+24) + +# print(int(True)) +# print(int(False)) + +#python literal +int1 = 0b1010 +int2 = 100 +int3 = 0o302 +int4 = 0x16e +print(int1,int2,int3,int4) + +float1 = 23.4353 +float2 = 10.5e4 +float3 = 13e-4 +print(float1,float2,float3) + +complex1 = 2+3j +complex2 = complex(3,4) +print(complex1,complex2) + +bool1 = True +bool2 = False + +print(bool1+3,bool2-2) + +str1 = 'Hello asif' +str2 = "Hello Arfi" +str3 = '''Hello Asma''' +print(str1,str2,str3) + +a = None +print(type(a)) \ No newline at end of file From 706a782f0962a30345c5fd716d370dfae3b48921 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Fri, 5 Sep 2025 20:28:49 +0600 Subject: [PATCH 049/115] git oop tasks added --- OOP/oop_1tasks.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 OOP/oop_1tasks.py diff --git a/OOP/oop_1tasks.py b/OOP/oop_1tasks.py new file mode 100644 index 0000000..1ea76fd --- /dev/null +++ b/OOP/oop_1tasks.py @@ -0,0 +1,21 @@ +class Rectangle: + def __init__(self,length,width): + self.length = length + self.width = width + + def perimeter(self): + parameter = 2 * (self.length + self.width) + return parameter + + def area(self): + area = self.length * self.width + return area + + def display(self): + print("The length of rectangle is:",self.length) + print("The width of rectangle is:",self.width) + print("The perimeter of rectangle is:",self.perimeter()) + print("The area of rectangle is:",self.area()) + +my_rectangle = Rectangle(3,4) +my_rectangle.display() \ No newline at end of file From 5101ed9b3a12244b6d2f55c742f2bdfa000cd399 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 7 Sep 2025 04:46:03 +0600 Subject: [PATCH 050/115] oop class 1 practice --- OOP/oop_1.py | 187 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 142 insertions(+), 45 deletions(-) diff --git a/OOP/oop_1.py b/OOP/oop_1.py index ee542de..d052940 100644 --- a/OOP/oop_1.py +++ b/OOP/oop_1.py @@ -4,56 +4,153 @@ # audi = Car() # print(audi) -class Atm: - def __init__(self): - self.pin ='' - self.balance = 0 - self.menu() - # print(f"pin is {self.pin} and balance is {self.balance}") +# class Car: +# def __init__(self): +# self.brand = "Audi" +# self.color = "Red" +# self.seat = 4 +# print('car brand is:{} color:{} seat:{}'.format(self.brand,self.color,self.seat)) + +# Audi = Car() +# ferari = Car() + +# class Car: +# def __init__(self,brand,color,seat): +# self.brand = brand +# self.color = color +# self.seat = seat +# print(f"{self.brand} car {self.color} color and {self.seat} seats") + +# Audi = Car("Mercedes","Black",4) + + + +# class Atm: +# def __init__(self): +# self.pin ='' +# self.balance = 0 +# self.menu() +# print(f"pin is {self.pin} and balance is {self.balance}") - def menu(self): - user_input = input(""" - Hi - What you want to do? - 1.press 1 to create pin - 2.press 2 to change pin - 3.press 3 to check balance - 4.press 4 to withdraw balance - 5.press 5 to exit - """) - if user_input == '1': - self.create_pin() - elif user_input == '2': - self.change_pin() - elif user_input == '3': - self.check_balance() +# def menu(self): +# user_input = input(""" +# Hi +# What you want to do? +# 1.press 1 to create pin +# 2.press 2 to change pin +# 3.press 3 to check balance +# 4.press 4 to withdraw balance +# 5.press 5 to exit +# """) +# if user_input == '1': +# self.create_pin() +# elif user_input == '2': +# self.change_pin() +# elif user_input == '3': +# self.check_balance() +# elif user_input == '4': +# self.withdraw_balance() +# else: +# exit() - def create_pin(self): - user_input =input("Enter a pin:") - self.pin = user_input - user_balance = int(input("Enter your balance:")) - self.balance = user_balance - print("Pin created successfully") - self.menu() +# def create_pin(self): +# user_input =input("Enter a pin:") +# self.pin = user_input +# user_balance = int(input("Enter your balance:")) +# self.balance = user_balance +# print("Pin created successfully") +# self.menu() - def change_pin(self): - pin = input("Enter your pin:") - if self.pin == pin: - new_pin = input("Enter new pin:") - self.pin = new_pin - print("Pin updated successfully") - else: - print("Wrong Pin") - self.menu() +# def change_pin(self): +# pin = input("Enter your pin:") +# if self.pin == pin: +# new_pin = input("Enter new pin:") +# self.pin = new_pin +# print("Pin updated successfully") +# else: +# print("Wrong Pin") +# self.menu() - def check_balance(self): - pin = input("Enter your pin:") - if self.pin == pin: - - +# def check_balance(self): +# pin = input("Enter your pin:") +# if self.pin == pin: +# print("Current balance is",self.balance) +# else: +# print("Your pin is incorrect") +# self.menu() + +# def withdraw_balance(self): +# pin = input("Enter your pin:") +# if self.pin == pin: +# amount = int(input("How much you wanna withdraw:")) +# if amount< self.balance: +# self.balance = self.balance - amount +# print("Balance is:",self.balance) +# else: +# print("You don't have that much") +# else: +# print("Wrong pin") +# self.menu() + +# def exit(self): +# self.menu() + +# obj = Atm() + + +#magic methods +# class Student: +# def __init__(self,name,age,id): +# # print(id(self)) +# self.name = name +# self.age = age +# self.id = id + +# def __str__(self): +# return f"name:{self.name} age:{self.age} id:{self.id}" + +# student_1 = Student("Asif",24,2323) +# print(id(student_1)) +# print(student_1) + +#creating our own data type - Fraction +class Fraction: + def __init__(self,num,den): + self.num = num + self.den = den + + def __str__(self): + return ('{}/{}'.format(self.num,self.den)) + + def __add__(self,other): + new_num = (self.num * other.den + other.num * self.den) + new_den = (self.den * other.den) + return '{}/{}'.format(new_num,new_den) + + def __sub__(self,other): + new_num = (self.num * other.den - other.num * self.den) + new_den = (self.den * other.den) + return '{}/{}'.format(new_num,new_den) + + def __mul__(self,other): + new_num = self.num * other.num + new_den = self.den * other.num + return '{}/{}'.format(new_num,new_den) + def __truediv__(self,other): + new_num = self.num * other.den + new_den = self.den * other.num + return '{}/{}'.format(new_num,new_den) -obj = Atm() +num1 = Fraction(5,8) +num2 = Fraction(4,5) +print(num1+num2) +print(num1-num2) +print(num1*num2) +print(num1/num2) +print(num1) - \ No newline at end of file +# complex1 = complex(4,5) +# complex2 = complex(5,6) +# print(complex1 + complex2) \ No newline at end of file From 4fc91154ac0c1eba9581d291b9fe9ba5f3fa6562 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 7 Sep 2025 04:46:34 +0600 Subject: [PATCH 051/115] some oop task added --- OOP/oop_1tasks.py | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/OOP/oop_1tasks.py b/OOP/oop_1tasks.py index 1ea76fd..2d8d382 100644 --- a/OOP/oop_1tasks.py +++ b/OOP/oop_1tasks.py @@ -1,3 +1,11 @@ +# Q-1: Rectangle Class +# Write a Rectangle class in Python language, allowing you to build a rectangle with length and width attributes. + +# Create a Perimeter() method to calculate the perimeter of the rectangle and a Area() method to calculate the area of ​​the rectangle. + +# Create a method display() that display the length, width, perimeter and area of an object created using an instantiation on rectangle class. + + class Rectangle: def __init__(self,length,width): self.length = length @@ -18,4 +26,32 @@ def display(self): print("The area of rectangle is:",self.area()) my_rectangle = Rectangle(3,4) -my_rectangle.display() \ No newline at end of file +my_rectangle.display() + +class BankAcount: + def __init__(self,accountNumber,name,balance): + self.accountNumber = accountNumber + self.name = name + self.balance = balance + + def Deposit(self,deposit): + # self.deposite = deposit + self.balance = self.balance + deposit + + def Withdrawal(self,withdraw): + self.balance = self.balance - withdraw + + def bankFees(self): + fees = self.balance * (5/100) + self.balance = self.balance - fees + + def display(self): + print("Account number : ",self.accountNumber) + print("Account Name : ",self.name) + print(f"Account Balance : {self.Withdrawal()}") + + +newAccount = BankAcount(2178514584,"Mandy",2800) +newAccount.Withdrawal(700) +newAccount.Deposit(1000) +newAccount.display() \ No newline at end of file From c9873a5a930a7b39c62c06ad8a4e8a8fca7ed4db Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 7 Sep 2025 08:52:58 +0600 Subject: [PATCH 052/115] codes added --- OOP/oop_1tasks.py | 133 +++++++++++++++++++++++++++++++++------------- 1 file changed, 95 insertions(+), 38 deletions(-) diff --git a/OOP/oop_1tasks.py b/OOP/oop_1tasks.py index 2d8d382..4eb6900 100644 --- a/OOP/oop_1tasks.py +++ b/OOP/oop_1tasks.py @@ -1,3 +1,6 @@ + +# -*- coding: utf-8 -*- + # Q-1: Rectangle Class # Write a Rectangle class in Python language, allowing you to build a rectangle with length and width attributes. @@ -6,52 +9,106 @@ # Create a method display() that display the length, width, perimeter and area of an object created using an instantiation on rectangle class. -class Rectangle: - def __init__(self,length,width): - self.length = length - self.width = width +# class Rectangle: +# def __init__(self,length,width): +# self.length = length +# self.width = width - def perimeter(self): - parameter = 2 * (self.length + self.width) - return parameter +# def perimeter(self): +# parameter = 2 * (self.length + self.width) +# return parameter - def area(self): - area = self.length * self.width - return area +# def area(self): +# area = self.length * self.width +# return area - def display(self): - print("The length of rectangle is:",self.length) - print("The width of rectangle is:",self.width) - print("The perimeter of rectangle is:",self.perimeter()) - print("The area of rectangle is:",self.area()) +# def display(self): +# print("The length of rectangle is:",self.length) +# print("The width of rectangle is:",self.width) +# print("The perimeter of rectangle is:",self.perimeter()) +# print("The area of rectangle is:",self.area()) -my_rectangle = Rectangle(3,4) -my_rectangle.display() +# my_rectangle = Rectangle(3,4) +# my_rectangle.display() -class BankAcount: - def __init__(self,accountNumber,name,balance): - self.accountNumber = accountNumber - self.name = name - self.balance = balance +# class BankAccount: +# def __init__(self,accountNumber,name,balance): +# self.accountNumber = accountNumber +# self.name = name +# self.balance = balance - def Deposit(self,deposit): - # self.deposite = deposit - self.balance = self.balance + deposit +# def Deposit(self,deposit): +# if deposit<=0: +# print("Deposit must be positive") +# else: +# self.balance = self.balance + deposit +# return self.balance - def Withdrawal(self,withdraw): - self.balance = self.balance - withdraw +# def Withdrawal(self,withdraw): +# self.balance = self.balance - withdraw +# return self.balance + +# def bankFees(self): +# fees = self.balance * (5/100) +# self.balance = self.balance - fees - def bankFees(self): - fees = self.balance * (5/100) - self.balance = self.balance - fees +# def get_balance(self): +# return f"{self.balance} ₹" - def display(self): - print("Account number : ",self.accountNumber) - print("Account Name : ",self.name) - print(f"Account Balance : {self.Withdrawal()}") +# def display(self): +# print("Account number : ",self.accountNumber) +# print("Account Name : ",self.name) +# # print(f"Account Balance :\u20B9 self.balance) + + +# newAccount = BankAccount(2178514584,"Mandy",2800) +# newAccount.Withdrawal(700) +# newAccount.Deposit(1000) +# newAccount.display() + +#q-3 + +# class Computation: +# def __init__(self): +# pass + +# def Factorial(self,n): +# for i in range(1,n+1): +# fact = 1 +# fact*=i +# return f"The factorial of {n} is : {fact}" +# # return 'The factorial of {} is : {}'.format(n,fact) +# def naturalSum(self,n): +# sum = (n * (n+1))/2 +# return f"The sum of {n} number is {sum}" + + + +# num = Computation() +# print(num.Factorial(6)) +# print(num.naturalSum(20)) + + +# Q-4 +# import random + +# class FlashCard: +# def __init__(self,name,color): +# self.fruit ={} +# # self.fruit[name]= color +# # print(self.fruit) + +# def add_fruit(self,) + + # def get_keys(self): + # count = 0 + # for i in self.frui + + # def get_fruit(self): + # random_key = random.randint(1,) + +# fruit = FlashCard("Banana","yellow") + -newAccount = BankAcount(2178514584,"Mandy",2800) -newAccount.Withdrawal(700) -newAccount.Deposit(1000) -newAccount.display() \ No newline at end of file +#Q-5 From c08fa0623d5643577a8591a1c3df40b6f9e906c5 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 7 Sep 2025 22:21:19 +0600 Subject: [PATCH 053/115] codes --- dsmp_campusx/session1_tasks.py | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/dsmp_campusx/session1_tasks.py b/dsmp_campusx/session1_tasks.py index fb1df90..05dde65 100644 --- a/dsmp_campusx/session1_tasks.py +++ b/dsmp_campusx/session1_tasks.py @@ -49,3 +49,38 @@ # print("interest is:",interest) +# Q6:- Write a program that will tell the number of dogs and chicken are there when the user will provide the value of total heads and legs. +#input from user +# head = int(input("Enter amount of heads:")) +# leg = int(input("Enter amount of legs:")) +# #calculation +# dog = + +# Q7:- Write a program to find the sum of squares of first n natural numbers where n will be provided by the user. +#input from user +# num = int(input("Enter a number:")) +# sum = 0 +# for i in range(1,num+1): +# sum = sum + (i*i) + +# # print("Sum is:",sum) +# sum = (num * (num + 1) * (2*num + 1))/6 +# print("sum is:",sum) + +# Q8:- Given the first 2 terms of an Arithmetic Series.Find the Nth term of the series. Assume all inputs are provided by the user. +# num1 = int(input("Enter 1st number:")) +# num2 = int(input("Enter 2nd number:")) +# diff = num2 - num1 +# n = int(input("nth term:")) + +# l = num1 + (n - 1)* diff +# print("n th term:",l) + +num1 = int(input("Enter numerator:")) +den1 = int(input("Enter a denominator:")) + +num2 = int(input("Enter numerator:")) +den2 = int(input("Enter a denominator:")) + +sum = (num1 * den2 + num2 * den1)/(den1 * den2) +print("Sum of two fraction:",sum) From a48beb09548b1ce0b794a05a047b2abf3734a883 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 7 Sep 2025 22:21:48 +0600 Subject: [PATCH 054/115] session 2 codes added --- dsmp_campusx/session2.py | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 dsmp_campusx/session2.py diff --git a/dsmp_campusx/session2.py b/dsmp_campusx/session2.py new file mode 100644 index 0000000..31876d1 --- /dev/null +++ b/dsmp_campusx/session2.py @@ -0,0 +1,63 @@ +# email = input("Enter email:") +# password = input("Enter password:") +# if email =="abc@gmail.com" and password== '1234': +# print("Welcome") +# else: +# print("Not correct") + +#min of three numbers +# int1 = int(input("1st num:")) +# int2 = int(input("2nd num:")) +# int3 = int(input("3rd num:")) + +# if int1 < int2 and int1 < int3: +# print(int1," is smallest") +# elif int2 < int3: +# print(int2," is smallest") +# else: +# print(int3," is smallest") + +#menu driven calculator +# f_num = int(input("Enter the 1st number:")) +# s_num = int(input("Enter the 2nd number:")) +# op = input("Enter the operation:") +# if op == '+': +# print(f_num+s_num) +# elif op == '-': +# print(f_num-s_num) +# elif op == '*': +# print(f_num * s_num) +# else: +# print(f_num/s_num) + +# menu = input(""" +# Hi!how can i help you? +# 1.Enter 1 for pin change +# 2.Enter 2 for balance check +# 3.Enter 3 for withdrawl +# 4.Enter 4 for exit +# """) +#have to create this with oop + +#number guessing game +# import random +# r_num = random.randint(1,10) +# print(r_num) +# u_num = int(input("Enter a number:")) + +# attempt = 1 +# while r_num != u_num: +# if r_num>u_num: +# print("guess is less") +# else: +# print("guess is higher") +# u_num = int(input("Enter number again:")) +# attempt +=1 +# else: +# print("Right guess at attempt:",attempt) + +curr_pop = 10000 +for i in range(10,0,-1): + print(i,curr_pop) + curr_pop = curr_pop - (0.1* curr_pop) + \ No newline at end of file From 33647db4a94bb3e7810f3f7d01781b10e1a57c52 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 7 Sep 2025 22:22:17 +0600 Subject: [PATCH 055/115] session 2 codes added --- dsmp_campusx/session2_tasks.py | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 dsmp_campusx/session2_tasks.py diff --git a/dsmp_campusx/session2_tasks.py b/dsmp_campusx/session2_tasks.py new file mode 100644 index 0000000..9471e74 --- /dev/null +++ b/dsmp_campusx/session2_tasks.py @@ -0,0 +1,37 @@ +#question 1 +# ctc = int(input("Enter CTC:")) +# hra = ctc * 0.1 +# da = ctc * 0.05 +# pf = ctc * 0.03 + +# salary = ctc - (hra + da + pf) + + +# if salary < 5: +# tax = ctc * 0.0 +# salary = (salary - tax)/12 +# elif salary >=5 and salary < 10: +# tax = ctc * 0.1 +# salary = (salary - tax)/12 +# elif salary >=10 and salary<20: +# tax = ctc * 0.2 +# salary = (salary - tax)/12 +# else: +# tax = ctc * 0.3 +# salary = (salary - tax)/12 + +# print(salary * 100000) + +#question 2 +# angle1 = float(input("Enter a angle:")) +# angle2 = float(input("Enter a angle:")) +# angle3 = float(input("Enter a angle:")) + +# sum_of_angles = angle1 + angle2 + angle3 + +# if sum_of_angles ==180.0 and (angle1 >0 and angle2 >0 and angle3 >0) : +# print("Can form a triangle") +# else: +# print("Cannot form a triangle") + +#question 3 From d3e22aefb46f238e1ddf6f1a9dd13e3f427f61f8 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 7 Sep 2025 22:57:09 +0600 Subject: [PATCH 056/115] some problems added --- dsmp_campusx/session2_tasks.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dsmp_campusx/session2_tasks.py b/dsmp_campusx/session2_tasks.py index 9471e74..7fedb21 100644 --- a/dsmp_campusx/session2_tasks.py +++ b/dsmp_campusx/session2_tasks.py @@ -35,3 +35,26 @@ # print("Cannot form a triangle") #question 3 +# Problem 3: Write a program that will take user input of cost price and selling price and determines whether its a loss or a profit. + +# cost_price = int(input("Enter cost price:")) +# selling_price = int(input("Enter selling price:")) + +# if selling_price > cost_price: +# print("Profit") +# elif selling_price == cost_price: +# print("No profit or loss") +# else: +# print("Loss") + +# # Problem 6 - Find the factorial of a given number. +# num = int(input("Enter a number:")) +# fact = 1 +# if num < 0 : +# print("Factorial doesn't exist for negative") +# elif num ==0: +# print("The factorial is 1") +# else: +# for i in range(1,num+1): +# fact *= i +# print(fact) From 5b04596de448598e0dfc6d3cb45bd29e8a4b3806 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Fri, 12 Sep 2025 21:06:37 +0600 Subject: [PATCH 057/115] string codes added --- dsmp_campusx/string.py | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 dsmp_campusx/string.py diff --git a/dsmp_campusx/string.py b/dsmp_campusx/string.py new file mode 100644 index 0000000..4d2e5e8 --- /dev/null +++ b/dsmp_campusx/string.py @@ -0,0 +1,56 @@ +# import sys +# str = "Hello Python" +# print(sys.getsizeof(str)) + +#creating string +# str1 = 'Hello Asif' +# str2 = "Hello Probin" +# str3 = '''Hello Hasan''' +# print(str1,str2,str3) + +# print("It's raining") +# print('Double " quotes') +# multi_string = """ +# Hi +# What do you want? +# """ +# print(multi_string) + +# str1 = str("Here is a string") +# print(str1) +# print(str([12,32,11])) + +#accessing substrings +s1 = "hello world" +# print(s1[1]) +# print(s1[2]) +# s1[20] +# print(s1[len(s1)-5]) + +#slicing +# print(s1[::1]) +# print(s1[1:4]) +# print(s1[5:]) +# print(s1[1::2]) +# print(s1[::-1]) +# print(s1[-1:-4:-1]) +# print(s1[-8:-4]) +# print(s1[-3:-1]) + +#edit and modify a string +# str1 = "I love Python" +# # str[0] ="W" +# # str1 = str[0] +# print(str1) +# del str1 +# print(str1) +# str1 = "I love Python" +# # del str[0:5] +# li = list(str1) +# print(li) +# li[0:2] ="We" +# print(li) +# s1 = ''.join(li) +# print(s1) + + From 3606cd1af10ad1c47f17e0a3462a4186ed38d5ad Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Fri, 12 Sep 2025 21:07:21 +0600 Subject: [PATCH 058/115] session1 codes --- dsmp_campusx/session1_tasks.py | 41 ++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/dsmp_campusx/session1_tasks.py b/dsmp_campusx/session1_tasks.py index 05dde65..e929881 100644 --- a/dsmp_campusx/session1_tasks.py +++ b/dsmp_campusx/session1_tasks.py @@ -4,7 +4,7 @@ # "Data" "Science" "Mentorship" "Program" # "By" "CampusX" -print("Data","Science","Mentorship","Program","Started","By","CampusX",sep="-",end='') +# print("Data","Science","Mentorship","Program","Started","By","CampusX",sep="-",end='') # Q2:- Write a program that will convert celsius value to fahrenheit. # Write your code here @@ -50,11 +50,11 @@ # Q6:- Write a program that will tell the number of dogs and chicken are there when the user will provide the value of total heads and legs. -#input from user -# head = int(input("Enter amount of heads:")) -# leg = int(input("Enter amount of legs:")) -# #calculation -# dog = +input from user +head = int(input("Enter amount of heads:")) +leg = int(input("Enter amount of legs:")) +#calculation +dog = # Q7:- Write a program to find the sum of squares of first n natural numbers where n will be provided by the user. #input from user @@ -76,11 +76,28 @@ # l = num1 + (n - 1)* diff # print("n th term:",l) -num1 = int(input("Enter numerator:")) -den1 = int(input("Enter a denominator:")) +# Q9:- Given 2 fractions, find the sum of those 2 fractions.Take the numerator and denominator values of the fractions from the user. +# num1 = float(input("Enter numerator:")) +# den1 = float(input("Enter a denominator:")) + +# num2 = float(input("Enter numerator:")) +# den2 = float(input("Enter a denominator:")) + +# sum = (num1 * den2 + num2 * den1)/(den1 * den2) +# print("Sum of two fraction:",sum) + +# Q10:- Given the height, width and breadth of a milk tank, you have to find out how many glasses of milk can be obtained? Assume all the inputs are provided by the user. + +import math +height = float(input("Enter height:")) +width = float(input("Enter width:")) +breadth = float(input("Enter breadth:")) + +vol = height * width * breadth -num2 = int(input("Enter numerator:")) -den2 = int(input("Enter a denominator:")) +glass_h = float(input("Enter glass height")) +glass_r =float(input("Enter glass radius")) +glass_v = math.pi * glass_h * (glass_r**2) -sum = (num1 * den2 + num2 * den1)/(den1 * den2) -print("Sum of two fraction:",sum) +glass_num =math.floor(vol / glass_v) +print("number of glasses:",glass_num) \ No newline at end of file From 4cfd201fed903173a50bb0fe02ec33576e5010ff Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Fri, 12 Sep 2025 21:07:43 +0600 Subject: [PATCH 059/115] Session2 --- dsmp_campusx/session2_tasks.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dsmp_campusx/session2_tasks.py b/dsmp_campusx/session2_tasks.py index 7fedb21..e8a95d2 100644 --- a/dsmp_campusx/session2_tasks.py +++ b/dsmp_campusx/session2_tasks.py @@ -58,3 +58,21 @@ # for i in range(1,num+1): # fact *= i # print(fact) + +num = int(input("Enter a number:")) + +# while num !=0: +# dig = num % 10 +# print(dig,end='') +# num = num //10 + +li = [] +while num % 10 !=0: + dig = num % 10 + li.append(dig) + num = num //10 + +print(li) +str ="" +str.join(li) +print(str) From 136e13f418f07a8d5fc3d74fc965d344fc37fcaf Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Fri, 12 Sep 2025 21:55:02 +0600 Subject: [PATCH 060/115] string codes added --- dsmp_campusx/string.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dsmp_campusx/string.py b/dsmp_campusx/string.py index 4d2e5e8..10fd670 100644 --- a/dsmp_campusx/string.py +++ b/dsmp_campusx/string.py @@ -53,4 +53,18 @@ # s1 = ''.join(li) # print(s1) +#operations on string +# f_name = "Md Asif" +# l_name = "ul Haque" +# print(f_name+" "+l_name) +# print("HI"*5) +# str ='abc' +# print(str*10) +# print("*"*50) +print('Dhaka'=='Kushtia') +print("Dhaka"=="Dhaka") +print("Dhaka"=="dhaka") +print("Dhaka"!="Dhaka") +print("Kushtia">"Dhaka") +print('Pune'>'pune') \ No newline at end of file From 5bdebe939f4e8d6081a2b6a62480994cbc321def Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sat, 13 Sep 2025 03:27:54 +0600 Subject: [PATCH 061/115] half way done --- dsmp_campusx/string.py | 55 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 6 deletions(-) diff --git a/dsmp_campusx/string.py b/dsmp_campusx/string.py index 10fd670..a781e04 100644 --- a/dsmp_campusx/string.py +++ b/dsmp_campusx/string.py @@ -62,9 +62,52 @@ # str ='abc' # print(str*10) # print("*"*50) -print('Dhaka'=='Kushtia') -print("Dhaka"=="Dhaka") -print("Dhaka"=="dhaka") -print("Dhaka"!="Dhaka") -print("Kushtia">"Dhaka") -print('Pune'>'pune') \ No newline at end of file +# print('Dhaka'=='Kushtia') +# print("Dhaka"=="Dhaka") +# print("Dhaka"=="dhaka") +# print("Dhaka"!="Dhaka") +# print("Kushtia">"Dhaka") +# print('Pune'>'pune') + +#logical operator +# print('hello' and 'world') +# print('Hello' or "World") +# print('' and 'Hi') +# print('' or 'World') +# print(not '') +# print(not 'Asif') + +#loops in strings +# str1 = "Hello Python" +# # for x in str1: +# # print("Asif") + +# for x in range(len(str1)): +# print(str1[x]) + +# #membership operator +# print('i' in 'Delhi') +# print('E' not in 'Eagle') +# print('e' in 'Eagl') + +#string functions +# print(len("I love Python")) +# print(max("Maximum Character")) +# print(min("HelloBangladesh")) +# print(sum("Asif")) + +#string functions +# s = "hello World" +# #capitalize - sentence er 1st word capital kore +# print(s.capitalize()) +# print("course createb by campusx".title()) +# #title - sentence er protita word er 1st letter capital kore +# print(s.title()) +# print("course created by campusx".title()) + +# #upper - converts all character to upper +# print("Uppercase values".upper()) +# print("Bangladesh".upper()) + +# print("lowercase values".lower()) +# print("lowercase".lower()) \ No newline at end of file From 030065e1392f622e8b4b2b05bb3d5abb1a42b2d9 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 14 Sep 2025 06:27:21 +0600 Subject: [PATCH 062/115] string codes added --- dsmp_campusx/string.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dsmp_campusx/string.py b/dsmp_campusx/string.py index a781e04..6288591 100644 --- a/dsmp_campusx/string.py +++ b/dsmp_campusx/string.py @@ -110,4 +110,5 @@ # print("Bangladesh".upper()) # print("lowercase values".lower()) -# print("lowercase".lower()) \ No newline at end of file +# print("lowercase".lower()) + From c815640c380bd669e41e79ccce1b036d418368b6 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 14 Sep 2025 06:27:51 +0600 Subject: [PATCH 063/115] operator codes practiced --- dsmp_campusx/operators.py | 62 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 dsmp_campusx/operators.py diff --git a/dsmp_campusx/operators.py b/dsmp_campusx/operators.py new file mode 100644 index 0000000..ed37241 --- /dev/null +++ b/dsmp_campusx/operators.py @@ -0,0 +1,62 @@ +print("Operators and operations") +#arithmetic operators +# print(5 + 6) +# print(10-6) +# print(10*3) +# print(30/4) +# print(40//6) +# print(50 % 7) +# print(12**3) + +#operator precedence (),**,* / // %,+ - +# print(23*(4+3)/7 - 2**3 ) + +#relational/comparison operator(>,>=,<,<=,==,!=) + +# print(5 > 4) +# print(51 >=53) +# print(3<4) +# print(5<=2) +# print(55==44) +# print(12!=32) + +#logical operator(and,or,not) +# print(True and True) +# print(True or False) +# print(not True) + +# print('' and 34) +# print("HEre is a") + +# print(23 or 43) +# print('' or 22) + +# print(not '') +#assignment operator(=,+=,-=,*=,/=,%=) + +# a = 10 +# b = 5 +# a+=b +# print(a) +# b-=a +# print(b) +# a*=b +# print(a) +# a/=b +# print(a) +# print(b) +# a = 23 +# b = 4 +# a//=b +# print(a) +# a%=b +# print(a) + +#identity operator +# print(10 is 30) +# print(5 is not 10) + +#membership operator +# print(4 in [23,4,32,1]) +# print("c" in "Cat") +# print("e" not in "Eagly") From 431bc0efb4c22573e561b467dd038de69f61310e Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 14 Sep 2025 06:32:26 +0600 Subject: [PATCH 064/115] codes --- dsmp_campusx/operators.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dsmp_campusx/operators.py b/dsmp_campusx/operators.py index ed37241..a743493 100644 --- a/dsmp_campusx/operators.py +++ b/dsmp_campusx/operators.py @@ -60,3 +60,12 @@ # print(4 in [23,4,32,1]) # print("c" in "Cat") # print("e" not in "Eagly") + +# Program - Find the sum of a 3 digit number entered by the user +num = int(input("Enter a 3 digit number:")) +a = num % 10 +num = num // 10 +b = num % 10 +num = num // 10 +c = num % 10 +print("sum is :",a+b+c) \ No newline at end of file From 2cdafca2aa4ef27ea4d3b9cddea86d4e2cb0a0ec Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 14 Sep 2025 07:43:18 +0600 Subject: [PATCH 065/115] control flow codes added --- dsmp_campusx/if_else.py | 54 +++++++++++++++++++++++++++++++++++++++ dsmp_campusx/operators.py | 14 +++++----- 2 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 dsmp_campusx/if_else.py diff --git a/dsmp_campusx/if_else.py b/dsmp_campusx/if_else.py new file mode 100644 index 0000000..56570b4 --- /dev/null +++ b/dsmp_campusx/if_else.py @@ -0,0 +1,54 @@ +# print("Control flow") + +# email = input("Enter your email:") +# password = input("Enter your password:") + +# if email =="abc@gmail.com" and password == "1234": +# print("login successful") +# elif email == "abc@gmail.com" and password != "1234": +# print("Incorrect password") +# password = input("Enter password again:") +# if password =="1234": +# print("Welcpme finally") +# else: +# print("Tumse nahi ho payega") +# else: +# print("Login failed") + +# age = 25 +# if age<=12: +# print("Child") +# elif age <=19: +# print("Teenger") +# elif age <=24: +# print("Young Adult") +# else: +# print("Adult") + +#max of three numbers +# num1 = int(input("Enter a number:")) +# num2 = int(input("Enter a number:")) +# num3 = int(input("Enter a number:")) +# if num1 >num2 and num1 > num3: +# print(num1," is greatest") +# elif num2>num3: +# print(num2," is greatest") +# else: +# print(num3," is greatest") + +#match case +# num1 = float(input("Enter a number:")) +# num2 = float(input("Enter a number:")) +# op = input("Enter an operator:") +# match op: +# case '+': +# print(num1+num2) +# case '-': +# print(num1 -num2) +# case '*': +# print(num1*num2) +# case '/': +# print(num1/num2) +# case _: +# print("Operation not valid") + \ No newline at end of file diff --git a/dsmp_campusx/operators.py b/dsmp_campusx/operators.py index a743493..a0ab2ce 100644 --- a/dsmp_campusx/operators.py +++ b/dsmp_campusx/operators.py @@ -62,10 +62,10 @@ # print("e" not in "Eagly") # Program - Find the sum of a 3 digit number entered by the user -num = int(input("Enter a 3 digit number:")) -a = num % 10 -num = num // 10 -b = num % 10 -num = num // 10 -c = num % 10 -print("sum is :",a+b+c) \ No newline at end of file +# num = int(input("Enter a 3 digit number:")) +# a = num % 10 +# num = num // 10 +# b = num % 10 +# num = num // 10 +# c = num % 10 +# print("sum is :",a+b+c) \ No newline at end of file From 31c487fb3aa8448cfe00ca25daa7f0a06fbc4258 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Fri, 10 Oct 2025 12:50:20 +0600 Subject: [PATCH 066/115] session 1 revise --- dsmp_campusx/session1_revise.py | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 dsmp_campusx/session1_revise.py diff --git a/dsmp_campusx/session1_revise.py b/dsmp_campusx/session1_revise.py new file mode 100644 index 0000000..527d7fb --- /dev/null +++ b/dsmp_campusx/session1_revise.py @@ -0,0 +1,49 @@ +import sys +print("Session 1 revise") + +# print("Hello World") +# print("Hello","I am",24) +# print("Asif",False,23.4,sep='-') +# print("Asif",False,23.4,sep=' ') +# print("Asif",False,23.4,sep=' ',end='\n') +# print("session1",end='/') + +#numeric type +# num1 = 234 +# num2 = 342425252242424 +# print(sys.getsizeof(num1)) +# print(sys.getsizeof(num2)) +# print(type(num1),type(num2)) + +# flo1 = 231.2323 +# flo2 = 3424424241.242424242 +# print(sys.getsizeof(flo1)) +# print(sys.getsizeof(flo2)) +# print(type(flo1),type(flo2)) +# bool1 = True +# bool2 = False +# print(sys.getsizeof(bool1)) +# print(type(bool2)) + +# complex1 = 3 + 4j +# print(sys.getsizeof(complex1)) +# num1 = complex(3,4) +# print(num1) + +#sequence type - list,tuple,string +# li = [23,"Asif",True] +# print(li,type(li)) +# str = "hello python" +# print(str,type(str)) + +# tu = (23,22,11,"Asif") +# print(tu,type(tu)) + +# set1 = {23,"Asif",True} +# print(set1,type(set1)) + +# dict1 = {"name":"Asif"} +# print(dict1,type(dict1)) + +# num1 = None +# print(num1,type(num1)) \ No newline at end of file From 82b3bae14d8e6ec9e5daef7b61fd57372f297568 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sat, 11 Oct 2025 14:14:43 +0600 Subject: [PATCH 067/115] practice finished --- dsmp_campusx/session1_revise.py | 80 ++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/dsmp_campusx/session1_revise.py b/dsmp_campusx/session1_revise.py index 527d7fb..68901a8 100644 --- a/dsmp_campusx/session1_revise.py +++ b/dsmp_campusx/session1_revise.py @@ -46,4 +46,82 @@ # print(dict1,type(dict1)) # num1 = None -# print(num1,type(num1)) \ No newline at end of file +# print(num1,type(num1)) + +#dynamic binding +# a = 3422 +# print(a) +# a = "Asif" +# print(a) +# b,c,d = 23,22,1 +# print(b,c,d) +# a=b=c= 100 +# print(id(a),id(b),id(c)) + +#keywords and identifier +# 1ab = 23 +# ab1 = 23 +# ab_23 = 2322 + +# # input1 = input("") + +# input1 = int(input("Enter a number:")) +# input2 = int(input("Enter a number:")) +# sum = input1 + input2 +# print(sum) + + +#type conversion +# print(10+10.5) #implicit +# num1 = int("23") +# print(num1) +# print(34+"34") + +#literals +# a = 2 +# print(a) +# a = 0b1010 +# print(a) +# a= 0o423 +# print(a) +# a = 0x12c +# print(a) + +# a = 22e10 +# print(a) + +# f = 12.342 +# print(f) +# f = 232.23e2 +# print(f) +# f = 211.e-3 +# print(f) + +# str1 = 'Hello Python' +# print(str1) +# str1 ="Hello Bro" +# print(str1) +# str1 = """Triple quotes""" +# print(str1) + +# print("escape characters\n \\ \'") + +#complex literals +# complex1 = 3 + 4j +# complex2 = complex(4,3) +# print(complex1,complex2) + +#boolean +# bool1 = True +# bool2 = False +# print(bool1,int(bool1)) +# print(bool2,int(bool2)) + +# a = True + 1 +# print(a) + +# b = False - 0 +# print(b) + +# a = None +# print(a) From 4be6015d5b795f236951681f700cf91958e70fbb Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Mon, 13 Oct 2025 21:51:40 +0600 Subject: [PATCH 068/115] string revise codes added --- dsmp_campusx/string_revise.py | 61 +++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 dsmp_campusx/string_revise.py diff --git a/dsmp_campusx/string_revise.py b/dsmp_campusx/string_revise.py new file mode 100644 index 0000000..34a200b --- /dev/null +++ b/dsmp_campusx/string_revise.py @@ -0,0 +1,61 @@ +print("String and methodss") +#string creation +# str1 = 'Hello Python' +# str2 = "My name is Asif" +# str3 = """Tripple quoted strings +# Hi I am Someone""" +# print(str1,str2,str3,end='\n',sep='\n') +# print('I am 24 year\"s old') +# num1 = 24 +# s1 = str(num1) +# print(s1,type(s1)) + +#accessing characters in a string + +# print(str1[1]) +# print(str1[0]) +# print(str1[2]) +# print(str1[4]) +# print(str1[20]) +# print(str1[-1]) +# print(str1[len(str1)-4]) +# print(str1[-4]) +# print(str1[len(str1)-6]) + +str1 = "Hello Python" +#string slicing [::] +# print(str1[:]) +# print(str1[1:5]) +# print(str1[3:]) +# print(str1[1:5:2]) +# print(str1[::-1]) +# print(str1[-5:]) + +#string is immutable - particular value change kora jai na ,notun string toiri hoy +# s1 = str1[1:4] +# print(s1) +# str[1:4] ="Asi" +# for x in str1: +# print(x) +str1 ="Hello Bangladesh" +# for i in range(len(str1)): +# print(str1[i]) +print(str1) +# del str1[1:4] +# del str1 +# print(str1) + +#update a string +# s = "Aello Asif" +# s1 = "H"+s[1:] +# print(s1) +# s2 = s.replace() + +#operators in string - concatenation(+),multiplication(*),membership +# print("MD Asif"+" "+"ul Haque") +# age = 24 +# # print("I am"+years old") +# print("Hi"*5) + +# print("Hi" in "Hi Bangladesh") + From 3b5c7a20ff7d35b3c78925feb0a8b53d514c865e Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Tue, 14 Oct 2025 01:35:08 +0600 Subject: [PATCH 069/115] session 2 codes added --- dsmp_campusx/session2_revise.py | 69 +++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 dsmp_campusx/session2_revise.py diff --git a/dsmp_campusx/session2_revise.py b/dsmp_campusx/session2_revise.py new file mode 100644 index 0000000..a88aba8 --- /dev/null +++ b/dsmp_campusx/session2_revise.py @@ -0,0 +1,69 @@ +print("Operators and control flow") + +#arithmetic(+,-,*,/,//,%,**) +# num1 = 24 +# num2 = 11 +# add = num1 + num2 +# sub = num1 - num2 +# multi = num1 * num2 +# div = num1 / num2 +# int_div = num1 //num2 +# mod = num1 %num2 +# print(add) +# print(sub) +# print(multi) +# print(div) +# print(int_div) +# print(mod) + +# a ,b = 3,4 +# print(a**b) + +#precedence of arithmetic operator-(),**(RL) // % /*,+,- +# a = 3 ** 4 ** 3 +# # print(a) +# b = (3+4)*4 +4-3*3 +# print(b) + +#comparison operator - (>,>=,<,<=,==,!=)-returns boolean +# print(4>5) +# print(23<45) +# print(55>=55) +# print(44<=23) +# print(44==34) +# print(34!=34) + +#is vs == +# print(12==23) +# print(12 is 12) + +# l1 = [1,2,3] +# l2 = [1,2,3] +# print(l1 == l2) +# print(l1 is l2) + +#logical operator +# print(True and False) +# print(True and True) +# print(False and True) +# print(False and False) +# print(12 and "Asif") +# print(0 and "Probin") +# print(False and [1,2,3]) + +# print(True or False) +# print(True or True) +# print(False or True) +# print(False or False) +# print("Asif" or 12) +# print(0 or "Asif") + +# print(23 and "Asif") #Asif +# print(0 or 2) # 2 +# print(0 and True) # 0 +# print("Asif" or False) #Asif + +# print(not 23) +# print(not False) + +#bitwise operator - performs on bits From d72eb9c9c9d415f525df880804f4ec4271554b81 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Wed, 15 Oct 2025 13:06:50 +0600 Subject: [PATCH 070/115] string codes added --- dsmp_campusx/string_revise.py | 73 ++++++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/dsmp_campusx/string_revise.py b/dsmp_campusx/string_revise.py index 34a200b..41a17fc 100644 --- a/dsmp_campusx/string_revise.py +++ b/dsmp_campusx/string_revise.py @@ -40,7 +40,7 @@ str1 ="Hello Bangladesh" # for i in range(len(str1)): # print(str1[i]) -print(str1) +# print(str1) # del str1[1:4] # del str1 # print(str1) @@ -59,3 +59,74 @@ # print("Hi" in "Hi Bangladesh") +#relational operator on string +# s1 = "Asif" +# s2 = "Probin" +# print(s1 > s2) +# print("cat">="CAT") +# print("Mumbai" < "Pune") +# print("Pune" <= "PUNE") +# print("Mumbai"=="MUMBAI") +# print("Mumbai"=="Mumbai") + +#logical operator on string + +# print("Asif" and "Hasan") +# print(0 and "Asif") +# print("Asif" or "Asifa") +# print(False or "Asif") +# print(not "Asif") +# print(not True) + +# print(not "") + +#membership - in/not in +# print("D" in "Delhi") +# print("D" not in "Asif") +# print("A" not in "Asif") + +#string methods-min,max,len,sorted +str1 = "Hello Bro" +# length = len(str1) +# print(length) + +# upper = str1.upper() +# print(upper) + +# lower = str1.lower() +# print(lower) + +# min_char = min(str1) +# print(min_char) +# print(max("Hello World")) +# print(min("Hello World")) +# str2 = "Bangladesh" +# min_char = min(str2) +# max_char = max(str2) +# print(min_char,max_char) + +#capitalize,title,upper,lower +# str1 = "hello asif" +# print(str1.capitalize()) +# print("i am 24".capitalize()) + +# print(str1.title()) +# print("i am 24 year old".title()) + +# print("asif is straight".upper()) +# print("Asif is 24 YEARS old".lower()) + +#strings revise +# s1 = "Hello Python" +# s2 = 'Hello Bro' +# s3 = """ +# Hello +# I am a multiline string +# """ + +# print(s1,s2,s3) +# print("Hi I am 24 year's old") +# print('I am 24 year"s old') + +# s4 = str("23") +# print(s4,type(s4)) From d5ca618ecd0aa11e62d2e9a8215cbd34df5196e3 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Mon, 20 Oct 2025 19:36:03 +0600 Subject: [PATCH 071/115] clean slate --- OOP/oop1_revise.py | 10 +++ OOP/oop_1.py | 58 ++++++++--------- OOP/session3.py | 18 ++++++ dsmp_campusx/if_else.py | 38 ++++++++++- dsmp_campusx/session1.py | 110 +++++++++++++++++++++++++------- dsmp_campusx/session1_revise.py | 102 +++++++++++++++++++++++++++++ dsmp_campusx/session2.py | 8 +-- dsmp_campusx/session2_revise.py | 66 +++++++++++++++++++ dsmp_campusx/session2_tasks.py | 44 +++++++++---- dsmp_campusx/session3.py | 16 +++++ dsmp_campusx/string_revise.py | 56 ++++++++++++++++ dsmp_campusx/string_tasks.py | 35 ++++++++++ 12 files changed, 489 insertions(+), 72 deletions(-) create mode 100644 OOP/oop1_revise.py create mode 100644 OOP/session3.py create mode 100644 dsmp_campusx/session3.py create mode 100644 dsmp_campusx/string_tasks.py diff --git a/OOP/oop1_revise.py b/OOP/oop1_revise.py new file mode 100644 index 0000000..3813b70 --- /dev/null +++ b/OOP/oop1_revise.py @@ -0,0 +1,10 @@ +print("Object Oriented Programming") + +# l = [2,342,22.4] +# print(type(l)) +# print(type([2,2,11,2])) + +class Phone: + pass + +samsung = Phone() diff --git a/OOP/oop_1.py b/OOP/oop_1.py index d052940..e93a8b4 100644 --- a/OOP/oop_1.py +++ b/OOP/oop_1.py @@ -115,41 +115,41 @@ # print(student_1) #creating our own data type - Fraction -class Fraction: - def __init__(self,num,den): - self.num = num - self.den = den +# class Fraction: +# def __init__(self,num,den): +# self.num = num +# self.den = den - def __str__(self): - return ('{}/{}'.format(self.num,self.den)) +# def __str__(self): +# return ('{}/{}'.format(self.num,self.den)) - def __add__(self,other): - new_num = (self.num * other.den + other.num * self.den) - new_den = (self.den * other.den) - return '{}/{}'.format(new_num,new_den) +# def __add__(self,other): +# new_num = (self.num * other.den + other.num * self.den) +# new_den = (self.den * other.den) +# return '{}/{}'.format(new_num,new_den) - def __sub__(self,other): - new_num = (self.num * other.den - other.num * self.den) - new_den = (self.den * other.den) - return '{}/{}'.format(new_num,new_den) +# def __sub__(self,other): +# new_num = (self.num * other.den - other.num * self.den) +# new_den = (self.den * other.den) +# return '{}/{}'.format(new_num,new_den) - def __mul__(self,other): - new_num = self.num * other.num - new_den = self.den * other.num - return '{}/{}'.format(new_num,new_den) +# def __mul__(self,other): +# new_num = self.num * other.num +# new_den = self.den * other.num +# return '{}/{}'.format(new_num,new_den) - def __truediv__(self,other): - new_num = self.num * other.den - new_den = self.den * other.num - return '{}/{}'.format(new_num,new_den) +# def __truediv__(self,other): +# new_num = self.num * other.den +# new_den = self.den * other.num +# return '{}/{}'.format(new_num,new_den) -num1 = Fraction(5,8) -num2 = Fraction(4,5) -print(num1+num2) -print(num1-num2) -print(num1*num2) -print(num1/num2) -print(num1) +# num1 = Fraction(5,8) +# num2 = Fraction(4,5) +# print(num1+num2) +# print(num1-num2) +# print(num1*num2) +# print(num1/num2) +# print(num1) # complex1 = complex(4,5) # complex2 = complex(5,6) diff --git a/OOP/session3.py b/OOP/session3.py new file mode 100644 index 0000000..c1d64a7 --- /dev/null +++ b/OOP/session3.py @@ -0,0 +1,18 @@ +class Customer: + def __init__(self,name,gender,address): + self.name = name + self.gender = gender + self.address = address + + def print_address(self): + print(self.address.city,self.address.pin,self.address.division) + +class Address: + def __init__(self,city,pin,division): + self.city = city + self.pin = pin + self.division = division + +add1 = Address("Kushtia",7040,"Khulna") +cust1 = Customer("Asif","Male",add1) +cust1.print_address() \ No newline at end of file diff --git a/dsmp_campusx/if_else.py b/dsmp_campusx/if_else.py index 56570b4..b100316 100644 --- a/dsmp_campusx/if_else.py +++ b/dsmp_campusx/if_else.py @@ -51,4 +51,40 @@ # print(num1/num2) # case _: # print("Operation not valid") - \ No newline at end of file + +#session 3 tasks +# Problem 1: Write a program that will give you in hand monthly salary after deduction on CTC - HRA(10%), DA(5%), PF(3%) and taxes deduction as below: +# Salary(Lakhs) : Tax(%) + +# Below 5 : 0% +# 5-10 : 10% +# 10-20 : 20% +# aboove 20 : 30% +# ctc = int(input("Enter ctc in lakhs:")) +# hra = ctc * 0.1 +# da = ctc * 0.05 +# pf = ctc * 0.03 +# salary = ctc - (hra + da + pf) +# if salary < 5: +# tax = salary * 0.0 +# monthly_salary = (salary - tax)/12 +# elif salary >=5 and salary <10: +# tax = salary * 0.1 +# monthly_salary = (salary - tax)/12 +# elif salary >=10 and salary <20: +# tax = salary * 0.2 +# monthly_salary = (salary - tax)/12 +# else: +# tax = salary * 0.3 +# monthly_salary = (salary - tax)/12 + +# print("monthly salary:",monthly_salary*100000) + +# Write a program that take a user input of three angles and will find out whether it can form a triangle or not. + +angle1 = float(input("Enter an angle:")) +angle2 = float(input("Enter an angle:")) +angle3 = float(input("Enter an angle:")) + +sum = angle1+angle2+angle3 + diff --git a/dsmp_campusx/session1.py b/dsmp_campusx/session1.py index 0b44f29..80cbe79 100644 --- a/dsmp_campusx/session1.py +++ b/dsmp_campusx/session1.py @@ -55,30 +55,92 @@ # print(int(False)) #python literal -int1 = 0b1010 -int2 = 100 -int3 = 0o302 -int4 = 0x16e -print(int1,int2,int3,int4) - -float1 = 23.4353 -float2 = 10.5e4 -float3 = 13e-4 -print(float1,float2,float3) - -complex1 = 2+3j -complex2 = complex(3,4) -print(complex1,complex2) - -bool1 = True -bool2 = False +# int1 = 0b1010 +# int2 = 100 +# int3 = 0o302 +# int4 = 0x16e +# print(int1,int2,int3,int4) + +# float1 = 23.4353 +# float2 = 10.5e4 +# float3 = 13e-4 +# print(float1,float2,float3) + +# complex1 = 2+3j +# complex2 = complex(3,4) +# print(complex1,complex2) + +# bool1 = True +# bool2 = False + +# print(bool1+3,bool2-2) + +# str1 = 'Hello asif' +# str2 = "Hello Arfi" +# str3 = '''Hello Asma''' +# print(str1,str2,str3) + +# a = None +# print(type(a)) + +#python - session1 revise +# print("Hello World") +# print("Hello Asif",True,234) +# print("Asif",24,False,sep='\n',end="") + +# #single line comment +# '''multiline comment +# dakjkfenfkak +# kdsjfdjkjn''' + +#data types - numeric +# a = 12322 +# b = 3424.443 +# c = True +# d = 3 + 4j +# print(a,type(a)) +# print(b,type(b)) +# print(c,type(c)) +# print(d,type(d)) + +#sequence type +# l = [233,342.4,"Asif",True] +# t = (21,"Asif",False) +# s = "Hello Asif" +# print(l,type(l)) +# print(t,type(t)) +# print(s,type(s)) + +# set1 ={23,22,22,11,11,"ASif"} +# print(set1,type(set1)) +# dic = { +# "name":"Asif", +# "age":24 +# } +# print(dic,type(dic)) + +# x = int(input()) +# print(x) +#dynamic binding +# a = "Hello" +# print(a) +# a = 34 +# print(a) +# a = True +# print(a) +# a,b,c = "Asif",24,True +# print(a,b,c) +# a=b=c = 100 +# print(id(a),id(b),id(c)) -print(bool1+3,bool2-2) +a = None + +# print(4+'4') -str1 = 'Hello asif' -str2 = "Hello Arfi" -str3 = '''Hello Asma''' -print(str1,str2,str3) +#type conversion +# a = "1.5" +# int_a = int(a) +# print(int_a,type(int_a)) +# print(a,type(a)) -a = None -print(type(a)) \ No newline at end of file +#literal diff --git a/dsmp_campusx/session1_revise.py b/dsmp_campusx/session1_revise.py index 68901a8..7687e85 100644 --- a/dsmp_campusx/session1_revise.py +++ b/dsmp_campusx/session1_revise.py @@ -125,3 +125,105 @@ # a = None # print(a) + + +#tasks - chatgpt +#age calculator +# birth_year = int(input("Enter birth year:")) +# current_year = 2025 +# current_age = current_year - birth_year +# print(f"You are {current_age} years old") + +#temperature converter +# celcius = float(input("Enter celcius temperature:")) +# fahrenheit = celcius * (9/5) + 32 +# print(f"celcius:{celcius} fehrenheit:{fahrenheit}") + +#bill splitter +# total_bill = float(input("Enter total amount:")) +# num_of_frnds = int(input("Enter number of friends:")) +# pay = total_bill/num_of_frnds +# print(f"one should pay {pay}") + +#rectangle area +# length = float(input("enter length:")) +# width = float(input("enter width:")) +# area = length * width +# print(f"area is : {area}") + +#string joiner +# first_name = input("enter first name:") +# last_name = input("enter last name:") +# full_name = first_name + " " + last_name +# print(f"Hello {full_name}") + + +#printing string +# print("Data","Science","Mentorship","Program","started","By","CampusX",end='\n',sep='-') + +# simple interest calculator +# principle = float(input("Enter principle amount:")) +# rate = float(input("enter interest rate:")) +# time = float(input("Enter years :")) +# interest = (principle * rate * time)/100 +# print(f"Interest :{interest}") + +#bmi calculator +# weight = float(input("Enter weight in kg:")) +# height_feet = float(input("enter height in feet:")) +# height = height_feet * 0.3048 +# BMI = weight / (height**2) +# print(f"BMI is:{BMI:0.2f}") + +#number swapper +# num1 = int(input("Enter a number:")) +# num2 = int(input("Enter another number:")) + +# num1,num2 = num2,num1 +# print(num1,num2) + + +#discount calculator +# original_price = float(input("Enter price:")) +# discount_amount = float(input("Enter discount amount:"))/100 +# final_price= original_price - (original_price*discount_amount) +# print(f"After discount :{final_price}") + +#seconds to hours +# seconds = int(input("Enter seconds:")) +# minutes = seconds % 60 +# second = seconds - minutes +# print(f"{minutes} minutes {second} seconds") + +#data summary +# num1 = float(input("Enter a number:")) +# num2 = float(input("Enter a number:")) +# num3 = float(input("Enter a number:")) +# sum = num1 + num2 + num3 +# average = (num1 + num2 + num3)/3 +# max_num = max(num1,num2,num3) +# min_num = min(num1,num2,num3) +# print(f"sum:{sum} average:{average} maximum:{max_num} minimum:{min_num}") + +#student info formatter +# stu_name = input("Enter student name:") +# age = int(input("Enter age:")) +# gpa = float(input("Enter gpa:")) +# print(f"Student: {stu_name}") +# print(f"Age: {age}") +# print(f"GPA: {gpa}") + +#salary breakdown +# monthly_salary = float(input("enter monthly salary:")) +# yearly_salary = monthly_salary * 12 +# tax_amount = yearly_salary * 0.1 +# net_income = yearly_salary - tax_amount +# print(f"yearly salary:{yearly_salary} tax:{tax_amount} net income:{net_income}") + +#currency converter +# amount_bdt = int(input("Enter amount in BDT:")) +# usd = amount_bdt / 121.38 +# inr = amount_bdt / 1.37 +# print(f"USD:{usd:0.2f}") +# print(f"INR:{inr:0.2f}") + diff --git a/dsmp_campusx/session2.py b/dsmp_campusx/session2.py index 31876d1..44f9dc9 100644 --- a/dsmp_campusx/session2.py +++ b/dsmp_campusx/session2.py @@ -56,8 +56,8 @@ # else: # print("Right guess at attempt:",attempt) -curr_pop = 10000 -for i in range(10,0,-1): - print(i,curr_pop) - curr_pop = curr_pop - (0.1* curr_pop) +# curr_pop = 10000 +# for i in range(10,0,-1): +# print(i,curr_pop) +# curr_pop = curr_pop - (0.1* curr_pop) \ No newline at end of file diff --git a/dsmp_campusx/session2_revise.py b/dsmp_campusx/session2_revise.py index a88aba8..4ee1db1 100644 --- a/dsmp_campusx/session2_revise.py +++ b/dsmp_campusx/session2_revise.py @@ -67,3 +67,69 @@ # print(not False) #bitwise operator - performs on bits + +#operators-symbols that perform calculations +# num1 = 20 +# num2 = 30 +# a = num1 + num2 +# #arithmetic operator - (+,-,*,/,%,//,**) +# sum = num1 + num2 +# print(sum) +# sub = num1 - num2 +# print(sub) +# multi = num1 * num2 +# print(multi) +# div = num1 / num2 +# print(div) +# flo = num2 //num1 +# print(flo) +# mod = num2 % num1 +# print(mod) + +# a,b = 4,5 +# print(a**b) + +#precedence of arithmetic operator-(),% // **,/ * + - +# a,b,c = 2,3,4 +# # print(a**b**c) +# x = 3 + 4 *(4+3)/4 -4 +# print(x) + +#relational / comparison operator - >,>=,<,<=,==,!= +# print(3>4) #false +# print(34>=31) #true +# print(10<42) #true +# print(98<=43) #false +# print(3==4) #false +# print(4!=4) #false + +#logical operator - and,or,not +# print(True and True) +# print(False and True) +# print(True and False) +# print(False and False) +# print("Asif" and 23) +# print("" and "Asif") + +# print(True or True) +# print(False or True) +# print(True or False) +# print(False or False) +# print("Asif" or 23) +# print("" or "Asif") + +# print(not "Asif") +# print(not "") +# print(not False) +# print(not None) + +# print("Hello" or "Python") #"Hello" +# print("" and "") #"" +# print("Asif" and "") #"" +# print(None or "Js") #js + +#bitwise operator + + + +#asignment operator - +=,-=,*=,/=,%=, \ No newline at end of file diff --git a/dsmp_campusx/session2_tasks.py b/dsmp_campusx/session2_tasks.py index e8a95d2..9c93c20 100644 --- a/dsmp_campusx/session2_tasks.py +++ b/dsmp_campusx/session2_tasks.py @@ -59,20 +59,36 @@ # fact *= i # print(fact) -num = int(input("Enter a number:")) +# num = int(input("Enter a number:")) -# while num !=0: +# # while num !=0: +# # dig = num % 10 +# # print(dig,end='') +# # num = num //10 + +# li = [] +# while num % 10 !=0: # dig = num % 10 -# print(dig,end='') +# li.append(dig) # num = num //10 - -li = [] -while num % 10 !=0: - dig = num % 10 - li.append(dig) - num = num //10 - -print(li) -str ="" -str.join(li) -print(str) + +# print(li) +# str ="" +# str.join(li) +# print(str) + + +# a = int(input("a = ")) +# b = int(input("b = ")) +# operator = int(input("operator = ")) +# if operator == 1: +# print(a+b) +# elif operator ==2: +# print(a-b) +# elif operator ==3: +# print(a*b) +# else: +# print("Invalid Input") + +#closest number + diff --git a/dsmp_campusx/session3.py b/dsmp_campusx/session3.py new file mode 100644 index 0000000..2b2eb68 --- /dev/null +++ b/dsmp_campusx/session3.py @@ -0,0 +1,16 @@ +# current_pop = 10000 +# for i in range(10,0,-1): +# print(i,current_pop) +# current_pop = current_pop / 1.1 + + +#nested loops +# for i in range(1,5): +# for j in range(1,5): +# print(i,j) + +# num = int(input("Enter rows:")) +for i in range(1,10): + for j in range(1,i+1): + print("*",end='') + print() \ No newline at end of file diff --git a/dsmp_campusx/string_revise.py b/dsmp_campusx/string_revise.py index 41a17fc..84d3e31 100644 --- a/dsmp_campusx/string_revise.py +++ b/dsmp_campusx/string_revise.py @@ -130,3 +130,59 @@ # s4 = str("23") # print(s4,type(s4)) + +#reverse a string +# s1 = "Hello Python" +# for i in range(len(s1)-1,-1,-1): +# print(s1[i],end="") + +#accessing a string-index +s1 = "John Doe" +# print(s1[0]) +# print(s1[2]) +# print(s1[3]) +# print(s1[-1]) +# print(s1[-5]) +# print(s1[10]) +# print(s1[len(s1)-5]) +# print(s1[len(s1)-7]) + +#string slicing[:]- slicing operator +# s1 = "Hello Python" +# print(s1[:]) +# print(s1[::-1]) +# print(s1[2:4]) +# print(s1[1:7:2]) +# print(s1[:-5:-1]) +# print(s1[-5:]) +# print(s1[]) + +#String and string methods +# str1 = "Hello Python" +# str2 = 'Hello Bro' +# str3 = '''Hello Asif''' +# print(str1,str2,str3,end='\n',sep='\n') + +# str4 = "I am 24 year's old" +# str5 = 'I am 24 year"s old' +# multiline_str = """Hi +# I am Asif +# Hi +# I am Probin +# """ +# print(str4) +# print(str5) +# print(multiline_str) + +# num = 24 +# num_str = str(num) +# print(type(num_str)) + +#accessing charaters in string - index +# s1 = "Hello Bangladesh" +# print(s1[0],s1[7]) +# # print(s1[18]) +# print(s1[len(s1)-5]) + + + diff --git a/dsmp_campusx/string_tasks.py b/dsmp_campusx/string_tasks.py new file mode 100644 index 0000000..8e17c66 --- /dev/null +++ b/dsmp_campusx/string_tasks.py @@ -0,0 +1,35 @@ +#reverse a string +# s1 = "Hello Python" +# for i in range(len(s1)-1,-1,-1): +# print(s1[i],end="") + +#palindrome check +s1 = "madame" +l1 = [] +for i in range(len(s1)-1,-1,-1): + l1.append(s1[i]) +s2 = "".join(l1) +if(s1==s2): + print("True") +else: + print("False") + +#specific character appearing +# s1 = "Banana" +# char = "a" +# counter = 0 +# for x in s1: +# if(x == char): +# counter+=1 +# print(counter) + +#string to title case +# s1 = "welcome to python" +# title_case = s1.title() +# print(title_case) + +s1 = "welcome to python" + + + +# \ No newline at end of file From 1424300f0aeadaade8d8853f4d59e90a3f8661c3 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Mon, 20 Oct 2025 19:58:01 +0600 Subject: [PATCH 072/115] string codes added --- dsmp_campusx/string_revise.py | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/dsmp_campusx/string_revise.py b/dsmp_campusx/string_revise.py index 84d3e31..71cbf9c 100644 --- a/dsmp_campusx/string_revise.py +++ b/dsmp_campusx/string_revise.py @@ -184,5 +184,41 @@ # # print(s1[18]) # print(s1[len(s1)-5]) +#slicing -[::](slicing operator) +# s1 = "Hello Bangladesh" +# s2 = s1[1:5:1] +# print(s2) +# s3 = s1[:6] +# print(s3) +# s4 = s1[::] +# print(s4) +# s5 = s1[::-1] +# print(s5) +# print(s1[:]) +# print(s1[:6:-1]) + +# s1 = "Hello Python" +# print(s1[-5:]) +# print(s1[-5:-4]) +# print(s1[-7:-4]) +# print(s1[-11:-5]) + +#string iteration +# s1 = "I am Asif" +# for x in s1: +# print(x) + +# for i in range(len(s1)): +# print(s1[i]) + +# for i in range(len(s1)-1,-1,-1): +# print(s1[i]) +#edit and delete a string +# s1 = "hello Asif" +# # s1[4] = "A" +# print(s1) +# del s1 +# print(s1) +#operators on string From 7c886ba28f889c306670257ea215abc1015e2ff6 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Mon, 20 Oct 2025 21:01:08 +0600 Subject: [PATCH 073/115] codes added --- dsmp_campusx/string_revise.py | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/dsmp_campusx/string_revise.py b/dsmp_campusx/string_revise.py index 71cbf9c..39174a4 100644 --- a/dsmp_campusx/string_revise.py +++ b/dsmp_campusx/string_revise.py @@ -222,3 +222,49 @@ # print(s1) #operators on string +#arithmetic - +,* +#concatenation = + +# f_name ="Md Asif" +# l_name ="ul Haque" +# full_name = f_name + l_name +# print(full_name) +# print("Bheramara"+","+"Kushtia") +# print("Asif"+"23") + +#multiplication = * +# print("Hi"*5) +# print("Hello world"*10,sep='-') + +#relational operator/comparison operator +# print("Asif" > "Probin") +# print("Asif" >="asif") +# print("Dhaka" < "Rajshahi") +# print("Book" <= "Pen") +# print("Mumbai" < "Delhi") +# print("Mumbai" < "Pune") +# print("Pune">'pune') +# print("Asif" < "asif") +# print("pune"<"rajastan") +# print("Asif"=="asif") +# print("Asif"=="Asif") +# print("Mumbai"!="Delhi") +# print("") + +# print("Asif" and "Probin") +# print("" and "Emon") +# print("Asif" or "Setu") +# print("" or "Asif") + +# print("") +# print(not "") +# print(not "Asif") +# print("Hi" or "bangladesh") +# print(False and "Python") +# print("Java" and "Script") +# print(False or "True") + +#membership operator - in/not in +# print("D" in "Delhi") +# print("d" in "Delhi") +# print("a" not in "Asif") +# print("b" not in "boss") \ No newline at end of file From 4c0cc0e697754a5f52b044973225c0d6821614ee Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Mon, 20 Oct 2025 21:03:10 +0600 Subject: [PATCH 074/115] string tasks added --- dsmp_campusx/string_tasks.py | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/dsmp_campusx/string_tasks.py b/dsmp_campusx/string_tasks.py index 8e17c66..140cfbf 100644 --- a/dsmp_campusx/string_tasks.py +++ b/dsmp_campusx/string_tasks.py @@ -28,8 +28,33 @@ # title_case = s1.title() # print(title_case) -s1 = "welcome to python" +# s1 = "welcome to python" + +# str = "hello" +# x="llo" + +# def titleIt(str): +# return str.title() + +# def casesSwap(str): +# return str.swapcase() + +# def find(str,x): +# return str.find(x) + +# print(titleIt(str)) +# print(casesSwap(str)) +# print(find(str,x)) +# s1 =[] +# for x in s: +# for y in s: +# if x !=y: +# s1.append(x) + +# print(s1) + +# s = "geEksforGEeks" +# l = [] -# \ No newline at end of file From 7c3b7917cef0ca53d6df4c113d473dcefbae725d Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Tue, 21 Oct 2025 14:31:00 +0600 Subject: [PATCH 075/115] session 2 codes added --- dsmp_campusx/session2_revise.py | 36 ++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/dsmp_campusx/session2_revise.py b/dsmp_campusx/session2_revise.py index 4ee1db1..a3ba402 100644 --- a/dsmp_campusx/session2_revise.py +++ b/dsmp_campusx/session2_revise.py @@ -129,7 +129,41 @@ # print(None or "Js") #js #bitwise operator +# print(3 & 4) +#asignment operator - +=,-=,*=,/=,%=, +# x = 100 +# print(x) +# x+=10 +# print(x) +# x-=20 +# print(x) +# x*=20 +# print(x) +# x/=35 +# print(x) +# x %= 10 +# print(x) -#asignment operator - +=,-=,*=,/=,%=, \ No newline at end of file +#membership operator - not in ,in(sequence data type based) +# print(2 in [2,3,4]) +# print(34 in [23,43,22]) +# print(43 not in [23,43,12]) +# print(4 in (3,3,2,4)) +# print(5 in (2,3,2,1)) +# print(1 not in (3,4,3,2)) +# print(1 not in (1,1,1)) + +#sum of a 4 digit number +num = int(input("Enter a 4 digit number:")) +d1 = num % 10 +num = num //10 +d2 = num %10 +num = num //10 +d3 = num % 10 +num = num //10 +d4 = num %10 +num = num //10 +sum = d1 + d2 + d3 + d4 +print("Sum of 4 digits:",sum) From 13227b61f4918dc0379c2d8c307188d3161e7537 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Tue, 21 Oct 2025 14:31:24 +0600 Subject: [PATCH 076/115] git revise codes added --- dsmp_campusx/string_revise.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dsmp_campusx/string_revise.py b/dsmp_campusx/string_revise.py index 39174a4..96fe5f2 100644 --- a/dsmp_campusx/string_revise.py +++ b/dsmp_campusx/string_revise.py @@ -267,4 +267,9 @@ # print("D" in "Delhi") # print("d" in "Delhi") # print("a" not in "Asif") -# print("b" not in "boss") \ No newline at end of file +# print("b" not in "boss") + +s1 = "Hello Asif" +print(max(s1)) +print(min(s1)) +print(len(s1)) \ No newline at end of file From 731eb297664a1b8421517ceaf2161b40e2ef60be Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Tue, 21 Oct 2025 14:31:51 +0600 Subject: [PATCH 077/115] string tasks added --- dsmp_campusx/string_tasks.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/dsmp_campusx/string_tasks.py b/dsmp_campusx/string_tasks.py index 140cfbf..5c6fb03 100644 --- a/dsmp_campusx/string_tasks.py +++ b/dsmp_campusx/string_tasks.py @@ -4,15 +4,18 @@ # print(s1[i],end="") #palindrome check -s1 = "madame" -l1 = [] +s1 = "madam" +l1 = list(s1) +l2 =[] for i in range(len(s1)-1,-1,-1): - l1.append(s1[i]) -s2 = "".join(l1) -if(s1==s2): - print("True") -else: - print("False") + l2.append(s1[i]) + +# l1.append(s1[i]) +# s2 = "".join(l1) +# if(s1==s2): +# print("True") +# else: +# print("False") #specific character appearing # s1 = "Banana" @@ -58,3 +61,9 @@ # s = "geEksforGEeks" # l = [] +# s1 = "Hello Python" +# for i in range(len(s1)-1,-1,-1): +# print(s1[i],sep='',end='') + +#remove leading and trailing spaces +s1 = " Hello world " From 50e8272410e5edd00b9405c607187bfaa34277d7 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Tue, 21 Oct 2025 15:06:49 +0600 Subject: [PATCH 078/115] session 2 codes --- dsmp_campusx/session2_revise.py | 89 +++++++++++++++++++++++++++++---- 1 file changed, 78 insertions(+), 11 deletions(-) diff --git a/dsmp_campusx/session2_revise.py b/dsmp_campusx/session2_revise.py index a3ba402..ac5c7c1 100644 --- a/dsmp_campusx/session2_revise.py +++ b/dsmp_campusx/session2_revise.py @@ -156,14 +156,81 @@ # print(1 not in (1,1,1)) #sum of a 4 digit number -num = int(input("Enter a 4 digit number:")) -d1 = num % 10 -num = num //10 -d2 = num %10 -num = num //10 -d3 = num % 10 -num = num //10 -d4 = num %10 -num = num //10 -sum = d1 + d2 + d3 + d4 -print("Sum of 4 digits:",sum) +# num = int(input("Enter a 4 digit number:")) +# d1 = num % 10 +# num = num //10 +# d2 = num %10 +# num = num //10 +# d3 = num % 10 +# num = num //10 +# d4 = num %10 +# num = num //10 +# sum = d1 + d2 + d3 + d4 +# print("Sum of 4 digits:",sum) + +#if-elseif-else +# age = 15 +# if age>=18: +# print("He can vote") +# else: +# print("He cannot vote") +# marks = 56 +# if marks >=90: +# print("A+") +# elif marks >=80: +# print("A") +# elif marks >=70: +# print("B") +# elif marks >=60: +# print("C") +# elif marks >=50: +# print("D") +# else: +# print("F") + +#if esle - login program +# email = input("Enter email here:") +# password = input("Enter password:") +# if email =="asif@gmail.com" and password=="1234": +# print("Welcome") +# elif email =="asif@gmail.com" and password !="1234": +# print("Incorrect Password") +# password = input("Enter password:") +# if password=="1234": +# print("Welcome") +# else: +# print("Beta tumse ho na payega") +# else: +# print("Wrong Password") + +#min of 3 numbers +# num1 = 11 +# num2 = 15 +# num3 = 21 +# if num1 < num2 and num2 Date: Sun, 26 Oct 2025 18:26:43 +0600 Subject: [PATCH 079/115] modules code added --- dsmp_campusx/session2_revise.py | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/dsmp_campusx/session2_revise.py b/dsmp_campusx/session2_revise.py index ac5c7c1..e8cc74f 100644 --- a/dsmp_campusx/session2_revise.py +++ b/dsmp_campusx/session2_revise.py @@ -234,3 +234,46 @@ # print("Withdraw balance") # elif menu =="5": # print("Go to menu") + +# import math +# factorial = math.factorial(5) +# print(factorial) + +# floor = math.floor(34.543) +# print(floor) + +# remainder = math.remainder(10,3) +# print(remainder) + +# sqrt = math.sqrt(16) +# print(sqrt) + +# help('modules') + +# import keyword +# print(keyword.kwlist) + +# import random +# random_number = random.randint(1,100) +# print(random_number) + +# random_choice = random.choice(['Asif','Emon','Hasan','Probin']) +# print(random_choice) + +# shuffle = random.shuffle([1,2,3,4,5,6]) +# print(shuffle) + +import datetime +date = datetime.date(1996,12,11) +print(date) +# print(datetime) +# today = date.today() +# print(today) + +# now = datetime.datetime.now() +# print(now) + +# today = datetime.date.today() +# print(today) + +# print(dir(datetime)) \ No newline at end of file From b93720d68d7ce3da3e61c23a52b42bb396ee8f02 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 26 Oct 2025 19:02:53 +0600 Subject: [PATCH 080/115] list codes added --- dsmp_campusx/list.py | 52 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 dsmp_campusx/list.py diff --git a/dsmp_campusx/list.py b/dsmp_campusx/list.py new file mode 100644 index 0000000..637469d --- /dev/null +++ b/dsmp_campusx/list.py @@ -0,0 +1,52 @@ +print("List and Methods") +# l1 = [12,34,21,33,33] +# print(l1,type(l1)) + +# l2 = list([2,22,11,22,11]) +# print(l2,type(l2)) + +# l3 = [1,2,3,4] +# print(id(l3[0])) +# print(id(l3[1])) +# print(id(l3[2])) + +#mixed list +# l1 = ["Asif",12,24.5,True] +# l2 = list("ASIF") +# print(l1) +# print(l2) + +# l1 = [100,200,300,400] +# print(l1[0]) +# print(l1[1]) +# print(l1[3]) +# print(l1[2]) + +# l1[3]= 350 +# print(l1) + +# l1.append("Asif") +# l1.append(True) +# l1.append(100) +# print(l1) + +# l1 = [1,2,3,4] +# l2 = [1,2,3,4] +# print(l1 == l2) +# print(l1 is l2) +# print(id(l1),id(l2)) + +#creating a list +# l1 = [] +# l2 = [12.4,78.23,11.9,45.6] +# l3 = ["Asif",19.99,True] +# l4 = [34,22,11,["Asif","Emon"]] +# # print(l4[0],l4[1],l4[2],l4[3][1]) +# l5 = [12,[12,33,[1,2,3],[2,3,4]]] +# print(l5[0],l5[1][2],l5[1][3][2]) +# # print(l1,l2,l3,l4,l5) + +# l1 = list([12,34,22]) +# l2 = list((19.99,23.99,11.11)) +# l3 = list("string") +# print(l1,l2,l3) \ No newline at end of file From b0807358cb8757d3f1e1e6940b269e007c420bd0 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 26 Oct 2025 19:58:30 +0600 Subject: [PATCH 081/115] loops code added --- dsmp_campusx/session2_revise.py | 57 ++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/dsmp_campusx/session2_revise.py b/dsmp_campusx/session2_revise.py index e8cc74f..6ab150e 100644 --- a/dsmp_campusx/session2_revise.py +++ b/dsmp_campusx/session2_revise.py @@ -276,4 +276,59 @@ # today = datetime.date.today() # print(today) -# print(dir(datetime)) \ No newline at end of file +# print(dir(datetime)) + +#loops - for ,while, +# l1 = [1,2,3,4,5] +# for x in l1: +# print(x) + +# t = (2,3,4,5,6) +# for x in t: +# print(x) + +# s = "Asif" +# for x in s: +# print(x) + +# for i in range(1,100,3): +# print(i) + +# for i in range(100,0,-1): +# print(i) + +# for i in range(0,11): +# if i == 3: +# break +# print(i) + +# for i in 'geeksforgeeks': +# if i == 'e' or i == 's': +# continue +# print(i) + +# for i in 'geeksforgeeks': +# if i =='e' or i =='s': +# break +# print(i) + +#for else with else +# for i in "Asif": +# if i == "A" or i =="f": +# print("Hi") +# else: +# print("Ho") + +#nested for loops +# for i in range(1,5): +# print(f"Iteration for {i}") +# for j in range(1,5): +# print(f"Iteration no {i} at {j}") + +#multiplication table for 5 +# for i in range(4,5): +# for j in range(1,11): +# multi = i * j +# print(f"{i} * {j} = {multi}") + + From db9f24dc62ee95d4d1c020dbeadda982dd5b409a Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 26 Oct 2025 21:31:50 +0600 Subject: [PATCH 082/115] loop codes added --- dsmp_campusx/session2_revise.py | 35 ++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/dsmp_campusx/session2_revise.py b/dsmp_campusx/session2_revise.py index 6ab150e..f5d1d9d 100644 --- a/dsmp_campusx/session2_revise.py +++ b/dsmp_campusx/session2_revise.py @@ -331,4 +331,37 @@ # multi = i * j # print(f"{i} * {j} = {multi}") - +# l1 =[12,32,23,11,33,22,43] +# for i in range(len(l1)): +# print(l1[i]) + +#while loops +# counter = 0 +# while counter <=5: +# print(counter) +# counter+=1 + +# s1 = "geeksforgeeks" +# i = 0 +# for i in range(len(s1)): +# if s1[i] == "e" or s1[i] =="s": +# continue +# print(s1[i]) + +# s1 = "geeksforgeeks" +# i = 0 +# while i Date: Sun, 26 Oct 2025 23:09:45 +0600 Subject: [PATCH 083/115] session 1 final --- dsmp_campusx/session1_revise.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dsmp_campusx/session1_revise.py b/dsmp_campusx/session1_revise.py index 7687e85..8d4b675 100644 --- a/dsmp_campusx/session1_revise.py +++ b/dsmp_campusx/session1_revise.py @@ -227,3 +227,4 @@ # print(f"USD:{usd:0.2f}") # print(f"INR:{inr:0.2f}") + From d6e80eea8ab0fb46ab89397d7975b869b54dccef Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 26 Oct 2025 23:10:11 +0600 Subject: [PATCH 084/115] list practiced --- dsmp_campusx/list.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dsmp_campusx/list.py b/dsmp_campusx/list.py index 637469d..e5781d2 100644 --- a/dsmp_campusx/list.py +++ b/dsmp_campusx/list.py @@ -49,4 +49,6 @@ # l1 = list([12,34,22]) # l2 = list((19.99,23.99,11.11)) # l3 = list("string") -# print(l1,l2,l3) \ No newline at end of file +# print(l1,l2,l3) + +#list accessing through slicing From fefe8cdfb44904029c5bebc8ff17a20f37653bbe Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 26 Oct 2025 23:10:41 +0600 Subject: [PATCH 085/115] session 2 codes --- dsmp_campusx/session2_tasks.py | 140 ++++++++++++++++++++++++++++++++- 1 file changed, 139 insertions(+), 1 deletion(-) diff --git a/dsmp_campusx/session2_tasks.py b/dsmp_campusx/session2_tasks.py index 9c93c20..588690b 100644 --- a/dsmp_campusx/session2_tasks.py +++ b/dsmp_campusx/session2_tasks.py @@ -90,5 +90,143 @@ # else: # print("Invalid Input") -#closest number +#temperature check +# current_temp = float(input("Enter current temp:")) +# if current_temp <20: +# print("It's cold") +# elif current_temp>=20 and current_temp<=30: +# print("It's pleasant") +# else: +# print("It's hot") + +#login system +# username = input("Enter username:") +# password = input("Enter password:") +# if username =="admin" and password == "1234": +# print("Login Successful") +# else: +# print("Access denied") + +#evenodd +# num = int(input("Enter a number:")) +# if num % 2 ==0: +# print("Even") +# else: +# print("Odd") + +#problem no -4 +# user_input = input(""" +# Hi.What do you want? +# 1.cm to fit +# 2.km to miles +# 3.USD to BDT +# 4.exit +# """) +# if user_input == "1": +# cm = float(input("Enter cm value:")) +# feet = cm/30.48 +# print(f"{cm} cm is {feet} feet") +# elif user_input =="2": +# km = float(input("Enter km value:")) +# miles = km * 0.6214 +# print(f"{km} kilo is {miles} miles") +# elif user_input =="3": +# usd = float(input("Enter USD:")) +# bdt = usd * 122.53 +# print(f"{usd} usd is {bdt} bdt") +# else: +# print("Exited") + +#fibonacci series upto 10 terms + +#movie ticket pricing +# age = int(input("Enter your age:")) + +# if age<18: +# if age<12: +# print("Ticket is 100") +# elif age >=12: +# print("Ticket is 150") +# else: +# print("Ticket is 200") + +#number comparison +# num1 = int(input("Enter a number")) +# num2 = int(input("Enter a number")) +# num3 = int(input("Enter a number")) +# if num1 == num2 or num1 ==num2 +# if num1 > num2 and num1 > num3: +# print(num1," is the greatest") +# elif num2 > num3: +# print(num2, " is the greatest") +# el: +# print(num3, " is the greatest") +# else: +# print("They are equal") + +#fibonacci +# ini = 0 +# mid = 1 +# # fin = mid + ini +# print(ini,mid,sep=',') +# for i in range(2,10): +# fin = mid + ini +# print(fin) +# ini = mid +# mid = fin + +#factorial of a given number +# i = 1 +# fact = 1 +# num = int(input("Enter a number:")) +# for i in range(num,0,-1): +# fact *= num +# num = num-1 +# print(fact) +# num = 7864 +# li = [] +# while num !=0: +# dig = num % 10 +# num = num // 10 +# li.append(dig) + +#guessing a number +# import random +# counter = 0 +# rand_num = random.randint(1,10) +# while True: +# counter+=1 +# user_input = int(input("Guess a number:")) +# if user_input == rand_num: +# print("You guessed right") +# print(f"Guess at {counter} attempt") +# break +# elif user_input > rand_num: +# print("You guessed higher") +# elif user_input< rand_num: +# print("You guessed lower") + + # user_input = int(input("Guess again")) + +#list filtering +# numbers = [12,23,21,33,22,33,44,24,142,1,1,414,42,4,42] +# for i in range(len(numbers)): +# if numbers[i]%2==0: +# print(numbers[i]) +# else: +# continue + +#login with attempts + +loop_count =1 +while loop_count<=3: + username = input("Enter username:") + password = input("Enter password:") + if username == "user" and password=="pass123": + print("Login successful") + break + else: + username = input("You have 2 chances:") + + From 83ce5cc19145d1dec3b7c64c18355b8f711db336 Mon Sep 17 00:00:00 2001 From: Md Asif ul Haque <141806630+asiflolcoder@users.noreply.github.com> Date: Tue, 28 Oct 2025 12:52:02 +0600 Subject: [PATCH 086/115] Update readme.md --- readme.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/readme.md b/readme.md index 60d4884..1fa5575 100644 --- a/readme.md +++ b/readme.md @@ -1,2 +1,10 @@ +#Python Pratice Code Here is a readme file to explore pull request Here is a readme line for practicting git merge + +#heading1 +##heading2 +###heading3 +####heading4 +#####heading5 +######heading6 From c0846b98c1955effb453ca15b9a939ae2f7dbcbe Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Wed, 29 Oct 2025 00:04:56 +0600 Subject: [PATCH 087/115] session 2 codes added --- dsmp_campusx/session2_revise.py | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/dsmp_campusx/session2_revise.py b/dsmp_campusx/session2_revise.py index f5d1d9d..9aa7979 100644 --- a/dsmp_campusx/session2_revise.py +++ b/dsmp_campusx/session2_revise.py @@ -16,6 +16,35 @@ # print(int_div) # print(mod) +# a = 10 +# b = 20.5 +# print(a+b) + +# a = 10 + 5j +# b = 20.5 +# print(a+b) + +# a = 5 +# b = 10.5 +# print(a-b) +# print(b-a) + +# x = 10 + 5j +# y = 20.5 +# print(x-y) +# print(y-x) + +#comparison/relational operator +# a = 15 +# b = 15.0 +# print(a>b) +# print(a=b) +# print(a<=b) +# print(a==b) +# print(a!=b) + + # a ,b = 3,4 # print(a**b) @@ -364,4 +393,22 @@ # print(multi,end=' ') # multiplicationTable(6) + +day = "Sunday" +match day: + case "Saturday": + print("Today is saturday") + case "Sunday": + print("Today is Sunday") + case "Monday": + print("Today is Monday") + case "Tuesday": + print("Today is Tuesday") + case "Wednesday": + print("Today is Wednesday") + case "Thursday": + print("Today is Thursday") + case _: + print("Invalid day") + \ No newline at end of file From 113a40b3929522d70c4b3d3f9dc1534a40e0ea29 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sat, 1 Nov 2025 13:00:46 +0600 Subject: [PATCH 088/115] file handling practiced --- File Handling/file.py | 40 +++++++++++++++++++++++++++++++++++++++ File Handling/sample1.txt | 4 ++++ File Handling/sample2.txt | 4 ++++ 3 files changed, 48 insertions(+) create mode 100644 File Handling/file.py create mode 100644 File Handling/sample1.txt create mode 100644 File Handling/sample2.txt diff --git a/File Handling/file.py b/File Handling/file.py new file mode 100644 index 0000000..fad2be2 --- /dev/null +++ b/File Handling/file.py @@ -0,0 +1,40 @@ +#if file is not present +# f = open('./File Handling/sample.txt','w') +# f.write("Hello Asif") +# f.close() +# f.write("I am Asif") + +#write multiline string +# f = open('./File Handling/sample1.txt','w') +# f.write("Hi") +# f.write('\nHow are you?') +# f.write("\nI am Asif") +# f.close() + +#if file is already present +# f = open('./File Handling/sample.txt','w') +# f.write("Salmon Bhai") +# f.close() + +#problem with w mode - replaces the whole file + +# f =open('./File Handling/sample.txt','a') +# f.write('\nMy name is Salman Khan\nI am unmarried') +# f.close() + +# f = open('./File Handling/sample1.txt','a') +# f.write("\nI am fine") +# f.close() + +#writelines +# l = ["\nAsif","\nEmon","\nProbin"] +# f = open('./File Handling/sample2.txt','w') +# f.writelines(l) +# f.close() + +# s = "Asif is 24 years old" +# f = open('./File Handling/sample2.txt','a') +# f.writelines(s) +# f.close() + +#reading from files \ No newline at end of file diff --git a/File Handling/sample1.txt b/File Handling/sample1.txt new file mode 100644 index 0000000..ab4a4cc --- /dev/null +++ b/File Handling/sample1.txt @@ -0,0 +1,4 @@ +Hi +How are you? +I am Asif +I am fine \ No newline at end of file diff --git a/File Handling/sample2.txt b/File Handling/sample2.txt new file mode 100644 index 0000000..def8bde --- /dev/null +++ b/File Handling/sample2.txt @@ -0,0 +1,4 @@ + +Asif +Emon +ProbinAsif is 24 years old \ No newline at end of file From e02dd96b87752b0067f02465c2c351db83aa18a2 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Mon, 3 Nov 2025 18:40:49 +0600 Subject: [PATCH 089/115] oop codes added --- OOP/basics.py | 237 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 237 insertions(+) create mode 100644 OOP/basics.py diff --git a/OOP/basics.py b/OOP/basics.py new file mode 100644 index 0000000..7e5e0de --- /dev/null +++ b/OOP/basics.py @@ -0,0 +1,237 @@ +print("OOP Basics") + +# l = [12,34,21,11] +# l.upper() +# l = [1,2,3,4,5] +# # l.upper() +# # s ="Hello" +# # s.append("a") +# print(type(l)) + +#create a class +# class Student: +# pass + +# asif = Student() + +# class Student: +# def __init__(self): +# self.name = "Md Asif" +# self.age = 24 +# print(f"{self.name} : {self.age}") +# student1 = Student() +# print(student1) + +# class Student: +# def __init__(self,name,age): +# self.name = name +# self.age = age +# print(f"{self.name}:{self.age}") + +# student1 = Student("Emon",25) +# student2 = Student("Probin",24) + + +# class Atm: +# def __init__(self): +# pass + +# class Student: +# def __init__(self,name,age): +# self.name = name +# self.age =age +# # print(id(self)) +# print(f"My name is {self.name} and I am {self.age} years old") + +# asif = Student("Asif",24) +# # print(id(asif)) +# emon = Student("Emon",25) + +# class Atm: +# def __init__(self): +# self.pin = "" +# self.balance = 0 +# # print("Atm object created") +# self.menu() + +# def menu(self): +# user_input = input(""" +# Hi How can i help you? +# 1.create pin +# 2.change pin +# 3.check balance +# 4.withdraw balance +# 5.Exit\n""") + +# if user_input =='1': +# self.create_pin() +# elif user_input =='2': +# self.change_pin() +# elif user_input == '3': +# self.check_balance() +# elif user_input =='4': +# self.withdraw_balance() +# else: +# self.exit() + + +# def create_pin(self): +# user_pin = input("Enter your pin:") +# self.pin = user_pin + +# user_balance = int(input("Enter your balance:")) +# self.balance = user_balance +# print("Pin created successfully") +# self.menu() + + +# def change_pin(self): +# old_pin = input("Enter your pin:") +# if old_pin == self.pin: +# new_pin = input("Enter new pin:") +# self.pin = new_pin +# print("Pin changed successfully") +# else: +# print("Password wrong,can't change") +# self.menu() + + +# def check_balance(self): +# pin = input("Enter your pin:") +# if pin == self.pin: +# print(f"You balance is {self.balance}") +# else: +# print("Wrong pin entered") +# self.menu() + +# def withdraw_balance(self): +# user_pin = input("Enter your piin:") +# if self.pin == user_pin: +# amount = int(input("Enter amount to withdraw:")) +# if amount<=self.balance: +# self.balance = self.balance - amount +# print("Withdraw successful .New Balance:",self.balance) +# else: +# print("You don't have that much money") +# else: +# print("Wrong Pin entered") +# self.menu() + +# def exit(self): +# self.menu() + + +# obj =Atm() + +#adding two objects +# class Point: +# def __init__(self,x,y): +# self.x = x +# self.y = y + +# def __add__(self,other): +# return (self.x +other.x,self.y+other.y) + +# p1 = Point(2,4) +# p2 = Point(4,5) +# print(p1 + p2) + +# class Student: +# def __init__(x): +# print("Object created") +# print(id(x)) + +# stu1 = Student() +# print(id(stu1)) + +#creating a customized data type - fraction +# class Fraction: +# def __init__(self,x,y): +# self.x = x +# self.y = y + +# def __str__(self): +# return '{}/{}'.format(self.x,self.y) + +# def __add__(self,other): +# num = self.x * other.y + self.y * other.x +# den = self.y * other.y +# return '{}/{}'.format(num,den) + +# def __sub__(self,other): +# self.num = self.x * other.y - self.y * other.x +# self.den = self.y * other.y +# return '{}/{}'.format(self.num,self.den) + +# def __mul__(self,other): +# self.num = self.x * other.x +# self.den = self.y * other.y +# return '{}/{}'.format(self.num,self.den) + +# def __truediv__(self,other): +# self.num = self.x * other.y +# self.den = self.y * other.x +# return '{}/{}'.format(self.num,self.den) + + +# obj1 = Fraction(3,4) +# obj2 = Fraction(4,5) +# print(obj1+obj2) +# print(obj1 - obj2) +# print(obj1 * obj2) +# print(obj1 / obj2) +# # print(obj1) + +# class Rectangle: +# def __init__(self,length,width): +# self.length = length +# self.width = width + +# def perimeter(self): +# perimeter = 2 * (self.length + self.width) +# return perimeter + +# def area(self): +# area = self.length * self.width +# return area + +# def display(self): +# print(f"The length of rectangle is: {self.length}") +# print(f"The width of rectangle is: {self.width}") +# print(f"The perimeter of rectangle is: {self.perimeter()}") +# print(f"The area of rectangle is: {self.area()}") + +# my_rectangle = Rectangle(3,4) +# my_rectangle.display() + +# class BankAccount: +# def __init__(self,accountNumber,name,balance): +# self.acc_num = accountNumber +# self.name = name +# self.balance = balance + +# def Deposit(self,deposit): +# self.balance = self.balance + deposit +# return self.balance + +# def Withdrawal(self,amount): +# self.balance = self.balance - amount +# return self.balance + +# def bankFees(self): +# fees = self.balance*0.05 +# return fees + +# def display(self): +# print(f"Account Number : {self.acc_num}") +# print(f"Account Name : {self.name}") +# print(f"Account Balance : {self.balance}") + + +# newAccount = BankAccount(2178514584, "Mandy" , 2800) + +# newAccount.Withdrawal(700) + +# newAccount.Deposit(1000) + +# newAccount.display() \ No newline at end of file From 254e4430fc2b3e30cd8c674fbb12fb0411def624 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Thu, 4 Dec 2025 12:11:27 +0600 Subject: [PATCH 090/115] error handling codes added --- error_handling.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 error_handling.py diff --git a/error_handling.py b/error_handling.py new file mode 100644 index 0000000..c7c2847 --- /dev/null +++ b/error_handling.py @@ -0,0 +1,49 @@ +print("Syntax Error") +# print "a" +# print "Hello World" +# marks = 80 +# if marks>=80: +# print("A+") +# if True + # print("Asif") +# fo i in ran(5): +# class A: + +#index error +# l=[1,2,3,4,5] +# print(l[50]) + +#module not found error +# import mata +# print(math.floor(10.4)) + +#key error +# dict1 ={"name":"Asif"} +# print(dict1["age"]) + +#typeerror +# print(1 +"a") + +#valueerror + + + + +#exceptions +# with open('sample.txt','w') as f: +# f.write("Hello World") + +# with open('sample.txt','r') as f: +# print(f.read()) + +# try: +# with open('sample1.txt','r') as f: +# print(f.read()) +# except: +# print("File not found") + +try: + with open('sample.txt','w') as f: + f.read() +except: + print("Operation failed") \ No newline at end of file From 3a3fb6e3bfc4d93580956217e0203737c51d77b9 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Thu, 4 Dec 2025 12:11:58 +0600 Subject: [PATCH 091/115] string codes added --- strings.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 strings.py diff --git a/strings.py b/strings.py new file mode 100644 index 0000000..d08573d --- /dev/null +++ b/strings.py @@ -0,0 +1,42 @@ +#creating string +# print('Hello World') +# print("Hello Python") +# print("""I am asif""") +# print("I am 24 year's old") +# print('I am " Asif') +# print("""Hello +# My name is +# Asif""") +# print(str(23)) +# li = str([12,3,2]) +# print(li,type(li)) + +#accessing the string - indexing/slicing +s1 = "Hello Bangladesh" +# print(s1[0]) +# print(s1[4]) +# print(s1[-2]) +# print(s1[len(s1)-5]) +# print(s1[::]) +# print(s1[::-1]) +# print(s1[2:6:2]) +# print(s1[:5]) +# print(s1[-1:-5:-1]) +# print(s1[-5:]) +# print(s1[-7:-3]) + +#edit and delete a string +#string is immutable , can't change particular value +s1 = "Hello Python" +# s1[0] ="A" +# print(s1) +# s2 = s1[:5] +# print(s2) +# s3 = s1[0] +# print(s3) +# del s1[0] +# del s1[:5] +# del s1 +# print(s1) + + From 26f0e6226e0e0f7447c21d17b7e22325d0fca0ba Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sat, 3 Jan 2026 22:38:40 +0600 Subject: [PATCH 092/115] basics revised --- basics.py | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 basics.py diff --git a/basics.py b/basics.py new file mode 100644 index 0000000..499d1b2 --- /dev/null +++ b/basics.py @@ -0,0 +1,68 @@ +print("Hello Basics From python") +print("asif",24,sep='-',end='\n') +print("Hello","World",24,True,end='',sep='') + +#single line comment +"""High +This is a +multi line +comment""" +import sys +#data types - numeric(int,float,boolean,complex) +# int_var = 24433432849486984 +# print(int_var,type(int_var)) +# print(sys.getsizeof(int_var)) + +# float_var = 12342242242242.24225223243224424 +# print(float_var,type(float_var)) +# print(sys.getsizeof(float_var)) + +# bool1 = True +# bool2 = False + +# print(bool1,type(bool1)) +# print(sys.getsizeof(bool1)) +# print(bool2,type(bool2)) +# print(sys.getsizeof(bool2)) + +# complex1 = 2 + 3j +# complex2 = complex(2,3) +# print(complex1,type(complex1)) +# print(sys.getsizeof(complex1)) + +#sequence typed - string,list,tuple +# str1 = "Hello Asif" +# print(str1,type(str1)) +# str2 = str(23) +# print(str2,type(str2)) +# print("\n") +# l1 = [12,3,342,42] +# t1 = (12,32,1132,23) +# print(l1,type(l1)) +# print(t1,type(t1)) + +# s = {12,3,22,324,2} +# print(s,type(s)) + +# dict1 = {"name":"Asif","age":24} +# print(dict1,type(dict1)) + +# a = None +# print(a,type(a)) + +# a = 23 +# print(a) +# a = "Asif" +# print(a) +# a = True +# print(a) + +# a,b,c = 23,34,22 +# print(a,b,c) + +# #keywords - for,if,else + +# a = b = c = 100 +# print(a,b,c) +# print(id(a),id(b),id(c)) + From 060f0e49ad558f3dc166099c3fbb54e74df7618b Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sat, 3 Jan 2026 23:23:56 +0600 Subject: [PATCH 093/115] some codes added --- basics.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/basics.py b/basics.py index 499d1b2..26f0cb4 100644 --- a/basics.py +++ b/basics.py @@ -66,3 +66,17 @@ # print(a,b,c) # print(id(a),id(b),id(c)) +# name = input("What's your name:") +# print("Your name is:",name) + +#type conversion +# var1 = int(123) +# # var2 = int("Asif") +# var2 = int(12.232) +# print(var1,var2) + +# var3 = float(23) +# print(var3) + +# print("23"+23) + From e1b09b15aa19c62af59de9bc36f7e4b95b9ee00e Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Thu, 8 Jan 2026 13:52:29 +0600 Subject: [PATCH 094/115] file handlingcodes added --- file-handling.py | 184 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 file-handling.py diff --git a/file-handling.py b/file-handling.py new file mode 100644 index 0000000..fb1ef0d --- /dev/null +++ b/file-handling.py @@ -0,0 +1,184 @@ +#if file is not present +# f = open('./sample.txt','w') +# f.write("Hello World") +# f.close() +# f.write("Asif") + +# f = open('./file-1.txt','w') +# f.write("Hello World") +# f.close() +# f.write("My name is Asif") + +#write multiline string +# f = open('./sample1.txt','w') +# f.write("Hello Emon\nThis is file 1") +# f.write('\n') +# f.write("I am 24 years old") +# f.write("\n") +# f.write("Closing file") +# f = open('./file-2.txt','w') +# f.write('Hello World') +# f.write('\n') +# f.write('I am 24 years old') +# f.close() +#if file is already present +# f = open("./sample.txt",'w') +# f.write("Salmon Bhai is my favourite") +# f.close() + + + +#append mode +# f = open('sample1.txt','a') +# f.write("Salmon bhai is my favourite") +# f.close() +# f = open('./sample1.txt','a') +# f.write("\n") +# f.write("Salmon bhai is the don") +# f.close() + +# for i in range(1,11): +# f = open('./sample1.txt','a') +# f.write(f"Hello {i}\n") +# f.close() + +#write many lines +# l = ['Hello\n','i am\n','Asif\n','Arfi\n'] +# f = open('./file-2.txt','w') +# f.writelines(l) +# f.close() +# obj1 = 'Hello Python' +# f = open('./file-2.txt','a') +# f.writelines(obj1) +# f.close() + +#reading from files - read(),readline() +# f = open('./file-2.txt','r') +# s = f.read() +# print(s) +# f.close() +# f = open('file-2.txt','r') +# print(f.readline()) +# print(f.readline()) +# s1 =f.readline() +# s2 =f.readline() +# print(s1) +# print(s2) +# f.close() + +#reading upto n characters +# f = open('./sample.txt','r') +# print(f.read()) +# f = open('./sample1.txt','r') +# print(f.read(20)) +# f.close() + +print("File handling revise") + +#if file is not present +# f = open('sample.txt','w') +# f.write("Hello Asif") +# f.close() +# f.write("I am writing something") + +#write multiline strings +# f = open('sample.txt','w') +# f.write("Asif") +# f.write("Emon") +# f.write("\nProbin") +# f.close() + +#case-2 : if the file is already present +# f = open('sample.txt','w') +# f.write("Hello Asif") +# f.write("\nI am 24 years old") +# f.close() + +# f = open('sample.txt','a') +# f.write('I am appending') +# f.write("How are you?") +# f.close() + +print("hi") + +# l = ["1","2","3","4","5"] +# t = ('Asif','emon','hasan') +# s = "\nASIF" +# # n = 1231 +# f = open('sample.txt','a') +# f.writelines(l) +# f.writelines(t) +# f.writelines(s) +# f.writelines(n) + + +#reading from files-read/readlines +# f = open('sample.txt','r') +# d = f.read() +# print(d) +# d1 = f.readline() +# d2 = f.readline() +# print(d1,d2) + + +# f = open('loop.txt','a') +# for i in range(1,11): +# f.write(f"Hello from {i}\n") +# f.close() + +# f = open('loop.txt','r') +# data = f.read() +# print(data) + +# f = open('loop.txt','r') +# d1 =f.readline() +# d2 =f.readline() +# d3 =f.readline() +# print(d1) +# print(d2) +# print(d3) + +# f = open('loop.txt','r') +# d =f.read(100) +# print(d) + +# print("hello") + +# f = open('loop.txt','r') +# l1 = f.readline() +# l2 = f.readline() +# print(l1) +# print(l2) + +#reading entire file using readline +# f = open('loop.txt','r') +# while True: +# data = f.readline() +# if data =='': +# break +# else: +# print(data,end='') + +# f.close() + +# f = open('file-2.txt','r') +# while True: +# data = f.readline() +# if data =='': +# break +# else: +# print(data,end='') + +# f.close() + +# with open('file-2.txt','a') as f: +# f.write("Salmon bhai") +# f.write("Hello") +# with open('file-2.txt','r') as f: +# data =f.read() +# print(data) + +# with open('file-2.txt','r') as f: +# data = f.readline() +# print(data) + From d91505cb323fbe8fdb25fac808493e1293e22b92 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Thu, 8 Jan 2026 15:50:03 +0600 Subject: [PATCH 095/115] basics problems added --- basics.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/basics.py b/basics.py index 26f0cb4..c7cc6fd 100644 --- a/basics.py +++ b/basics.py @@ -1,6 +1,6 @@ -print("Hello Basics From python") -print("asif",24,sep='-',end='\n') -print("Hello","World",24,True,end='',sep='') +# print("Hello Basics From python") +# print("asif",24,sep='-',end='\n') +# print("Hello","World",24,True,end='',sep='') #single line comment """High @@ -80,3 +80,7 @@ # print("23"+23) +print("Data","Science","Mentorship","Progran","By","CampusX",sep='-',end="\n") + +# celcius = input(float("Enter celcius value:")) + From 39325e1849d890c066a9d8b5ad7829f824dc2d4d Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 11 Jan 2026 13:19:29 +0600 Subject: [PATCH 096/115] string codes added --- store_sales.csv | 101 ++++++++++++++++++++++++++++++++++++++++++++++++ string.py | 24 ++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 store_sales.csv create mode 100644 string.py diff --git a/store_sales.csv b/store_sales.csv new file mode 100644 index 0000000..0318ba6 --- /dev/null +++ b/store_sales.csv @@ -0,0 +1,101 @@ +order_id,customer_name,product,category,quantity,unit_price,total,order_date,country,payment_method +1,Tanvir,Jeans,Fashion,4,1500,6000,2025-01-18,Nepal,Card +2,Tanvir,Jeans,Fashion,5,1500,7500,2025-01-12,Pakistan,Card +3,Naila,Keyboard,Electronics,4,1200,4800,2025-01-22,Nepal,Card +4,Karim,Keyboard,Electronics,3,1200,3600,2025-01-23,Bangladesh,Card +5,Nahid,Keyboard,Electronics,1,1200,1200,2025-01-22,Nepal,Cash +6,Ayesha,Mobile,Electronics,1,25000,25000,2025-01-11,Nepal,Cash +7,Imran,Jeans,Fashion,1,1500,1500,2025-02-03,Nepal,UPI +8,Karim,Headphones,Electronics,2,3500,7000,2025-01-05,Pakistan,Card +9,Rahim,Headphones,Electronics,5,3500,17500,2025-01-01,India,UPI +10,Rafi,Headphones,Electronics,2,3500,7000,2025-01-11,Bangladesh,Card +11,Imran,T-Shirt,Fashion,2,500,1000,2025-01-26,Bangladesh,UPI +12,Imran,Jeans,Fashion,3,1500,4500,2025-01-11,Nepal,Cash +13,Asif,Headphones,Electronics,1,3500,3500,2025-01-05,Nepal,Card +14,Asif,Mouse,Electronics,5,600,3000,2025-01-01,Nepal,Card +15,Karim,Keyboard,Electronics,5,1200,6000,2025-01-14,Nepal,Card +16,Naila,Jeans,Fashion,3,1500,4500,2025-01-25,Pakistan,Cash +17,Rahim,Keyboard,Electronics,5,1200,6000,2025-01-23,Pakistan,UPI +18,Naila,Mouse,Electronics,4,600,2400,2025-01-21,Sri Lanka,UPI +19,Hasan,Headphones,Electronics,2,3500,7000,2025-01-31,Nepal,Card +20,Sadia,Shoes,Fashion,3,2000,6000,2025-01-13,Nepal,Card +21,Hasan,Mouse,Electronics,3,600,1800,2025-02-05,Bangladesh,Cash +22,Karim,Mouse,Electronics,3,600,1800,2025-01-24,Sri Lanka,Cash +23,Sadia,Shoes,Fashion,2,2000,4000,2025-02-02,Pakistan,Cash +24,Nahid,T-Shirt,Fashion,4,500,2000,2025-02-02,Bangladesh,Card +25,Imran,Mobile,Electronics,1,25000,25000,2025-01-23,Pakistan,UPI +26,Hasan,T-Shirt,Fashion,2,500,1000,2025-02-02,Bangladesh,UPI +27,Ayesha,Keyboard,Electronics,2,1200,2400,2025-01-15,Pakistan,Cash +28,Imran,Mouse,Electronics,2,600,1200,2025-01-18,Bangladesh,Cash +29,Hasan,Keyboard,Electronics,4,1200,4800,2025-01-04,Nepal,Cash +30,Naila,T-Shirt,Fashion,1,500,500,2025-02-03,Bangladesh,Cash +31,Naila,Shoes,Fashion,3,2000,6000,2025-01-10,Nepal,Card +32,Tanvir,Headphones,Electronics,5,3500,17500,2025-01-09,Bangladesh,Card +33,Nahid,Keyboard,Electronics,2,1200,2400,2025-01-03,Nepal,UPI +34,Sadia,Jeans,Fashion,3,1500,4500,2025-01-07,Sri Lanka,Card +35,Naila,Mouse,Electronics,3,600,1800,2025-01-08,Pakistan,Card +36,Karim,T-Shirt,Fashion,2,500,1000,2025-01-30,Bangladesh,Cash +37,Karim,Shoes,Fashion,5,2000,10000,2025-01-20,Nepal,UPI +38,Ayesha,Keyboard,Electronics,5,1200,6000,2025-02-03,Bangladesh,UPI +39,Rahim,T-Shirt,Fashion,1,500,500,2025-02-03,Nepal,Cash +40,Naila,Keyboard,Electronics,3,1200,3600,2025-01-13,India,Cash +41,Tanvir,Mobile,Electronics,1,25000,25000,2025-01-25,India,Card +42,Asif,Jeans,Fashion,1,1500,1500,2025-01-06,Nepal,Cash +43,Nahid,T-Shirt,Fashion,5,500,2500,2025-01-28,Bangladesh,UPI +44,Hasan,Mobile,Electronics,1,25000,25000,2025-01-28,Bangladesh,Cash +45,Asif,Mobile,Electronics,1,25000,25000,2025-01-16,Pakistan,Cash +46,Rafi,Mouse,Electronics,1,600,600,2025-01-04,Pakistan,UPI +47,Tanvir,Keyboard,Electronics,1,1200,1200,2025-01-24,Sri Lanka,UPI +48,Imran,Mouse,Electronics,3,600,1800,2025-01-09,Bangladesh,Card +49,Hasan,Keyboard,Electronics,1,1200,1200,2025-01-12,India,Cash +50,Hasan,Jeans,Fashion,2,1500,3000,2025-01-27,Pakistan,UPI +51,Rafi,Keyboard,Electronics,4,1200,4800,2025-01-31,Bangladesh,Cash +52,Ayesha,Shoes,Fashion,1,2000,2000,2025-01-28,Pakistan,Cash +53,Tanvir,Headphones,Electronics,4,3500,14000,2025-01-21,Bangladesh,Card +54,Asif,Shoes,Fashion,3,2000,6000,2025-01-13,India,Cash +55,Asif,Mouse,Electronics,5,600,3000,2025-01-10,Nepal,Cash +56,Hasan,Headphones,Electronics,5,3500,17500,2025-01-09,Pakistan,Cash +57,Nahid,Mouse,Electronics,2,600,1200,2025-01-15,Sri Lanka,Card +58,Karim,T-Shirt,Fashion,2,500,1000,2025-01-14,Pakistan,Cash +59,Asif,Mobile,Electronics,5,25000,125000,2025-01-30,Bangladesh,UPI +60,Imran,Shoes,Fashion,3,2000,6000,2025-01-07,Nepal,Cash +61,Sadia,Keyboard,Electronics,4,1200,4800,2025-01-14,Nepal,UPI +62,Nahid,Headphones,Electronics,3,3500,10500,2025-01-15,Sri Lanka,Card +63,Naila,Keyboard,Electronics,1,1200,1200,2025-01-01,India,UPI +64,Nahid,Mouse,Electronics,5,600,3000,2025-01-15,Sri Lanka,Cash +65,Hasan,Mouse,Electronics,1,600,600,2025-01-08,Bangladesh,Cash +66,Ayesha,Jeans,Fashion,2,1500,3000,2025-01-31,Nepal,Card +67,Sadia,Headphones,Electronics,2,3500,7000,2025-01-11,Sri Lanka,UPI +68,Karim,Mouse,Electronics,2,600,1200,2025-01-27,Sri Lanka,UPI +69,Sadia,Headphones,Electronics,4,3500,14000,2025-02-03,India,Cash +70,Imran,Jeans,Fashion,2,1500,3000,2025-02-05,India,Cash +71,Nahid,Mobile,Electronics,1,25000,25000,2025-01-08,Pakistan,Cash +72,Nahid,T-Shirt,Fashion,4,500,2000,2025-02-04,India,UPI +73,Rahim,T-Shirt,Fashion,1,500,500,2025-01-02,Nepal,UPI +74,Nahid,Keyboard,Electronics,5,1200,6000,2025-01-11,Nepal,Card +75,Hasan,Headphones,Electronics,5,3500,17500,2025-01-10,Bangladesh,Cash +76,Ayesha,Headphones,Electronics,4,3500,14000,2025-01-11,Pakistan,Cash +77,Ayesha,Mobile,Electronics,2,25000,50000,2025-02-03,India,Cash +78,Ayesha,Headphones,Electronics,4,3500,14000,2025-01-17,India,Card +79,Ayesha,Shoes,Fashion,1,2000,2000,2025-01-28,Bangladesh,UPI +80,Rahim,Mobile,Electronics,3,25000,75000,2025-01-23,Bangladesh,UPI +81,Tanvir,Shoes,Fashion,2,2000,4000,2025-01-17,India,Card +82,Naila,Mobile,Electronics,3,25000,75000,2025-01-22,Sri Lanka,Cash +83,Ayesha,Headphones,Electronics,4,3500,14000,2025-01-21,Pakistan,UPI +84,Naila,T-Shirt,Fashion,3,500,1500,2025-01-19,India,Card +85,Rafi,Jeans,Fashion,1,1500,1500,2025-01-18,Pakistan,Card +86,Karim,Keyboard,Electronics,3,1200,3600,2025-01-05,India,Cash +87,Rahim,Shoes,Fashion,1,2000,2000,2025-01-14,Nepal,Card +88,Ayesha,Headphones,Electronics,3,3500,10500,2025-01-12,Pakistan,Cash +89,Rafi,Mobile,Electronics,2,25000,50000,2025-01-14,Pakistan,Card +90,Naila,Jeans,Fashion,4,1500,6000,2025-01-03,Pakistan,Card +91,Hasan,Mouse,Electronics,2,600,1200,2025-01-15,Pakistan,Card +92,Asif,Mouse,Electronics,5,600,3000,2025-01-10,Pakistan,Cash +93,Nahid,T-Shirt,Fashion,5,500,2500,2025-01-26,Nepal,Cash +94,Nahid,Shoes,Fashion,2,2000,4000,2025-01-25,India,Card +95,Tanvir,Mobile,Electronics,4,25000,100000,2025-01-11,Sri Lanka,UPI +96,Nahid,Shoes,Fashion,2,2000,4000,2025-01-27,Pakistan,Cash +97,Tanvir,Shoes,Fashion,1,2000,2000,2025-01-05,Nepal,UPI +98,Asif,Mouse,Electronics,2,600,1200,2025-02-01,Nepal,Card +99,Ayesha,Headphones,Electronics,5,3500,17500,2025-01-22,Pakistan,Cash +100,Rahim,Jeans,Fashion,4,1500,6000,2025-01-09,Pakistan,UPI diff --git a/string.py b/string.py new file mode 100644 index 0000000..c429b9c --- /dev/null +++ b/string.py @@ -0,0 +1,24 @@ +print("String and methods") + +# s1 = 'Hello Asif' +# s2 = "Hello Emon" +# s3 = """I am +# 24 years old""" + +# print(s1,s2,s3) +# s4 = str(2443.4) +# print(s4,type(s4)) + +# print("Hi i am 30 year's old") +# print('Hlw How are "you"') + +#accessing stings-indexing.slicing +s = "Hello Python" +# print(s[0]) +# print(s[6]) +# print(s[-1]) +# print(s[len(s)-6]) + +# print(s[15]) + +#slicing From 5e4173d2e75e8ed2a97641b22894a6e10f3f39ab Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 11 Jan 2026 18:28:48 +0600 Subject: [PATCH 097/115] strings code added --- string.py | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/string.py b/string.py index c429b9c..febe8e0 100644 --- a/string.py +++ b/string.py @@ -22,3 +22,57 @@ # print(s[15]) #slicing +# print(s[::]) +# print(s[::-1]) +# print(s[0:6:2]) +# print(s[1:5]) +# print(s[-1:-5:-1]) +# print(s[-1::]) +# print(s[-6:]) +# print(s[-5:-1]) + +#editing and deleting strings +# s[0] ="A" +# s1 = s[0] +# print(s1) +# s2 = s[1:4] +# print(s2) +# del s[0] +# del s[0:5] +# del s +# print(s) + +#operations on string +# print("Asif"+" "+"Arfi") +# print("Delhi"+ "Mumbai") +# print("Asif"*3) +# print("Asif"-23) +# print("*"*50) +# print("Asif">"Cinema") +# print("Emon">) + +#relational operator +# print("Asif"=="Asif") +# print(12 == 12.00) +# print("Dhaka"!="dhaka") +# print("Asif">"Asif") +# print("Asif"<"Emon") +# print('qwer'>="1234") + +# print("Asif" and "Afiya") +# print("" and "A") + +# print("Asif" or 12) +# print(False and "Asif") + +# print(not "") +# print(not "Asif") + +# for i in "Hello World": +# print(i) + +# s = "Asif is 24 years old" +# for i in range(0,len(s)): +# print(s[i]) + +#functions-len,min,max,sorted From 2df753ec1eaa857733d32b82adb7b61b942e9763 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Mon, 12 Jan 2026 19:23:19 +0600 Subject: [PATCH 098/115] string codes added --- string.py | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/string.py b/string.py index febe8e0..2eead0a 100644 --- a/string.py +++ b/string.py @@ -76,3 +76,68 @@ # print(s[i]) #functions-len,min,max,sorted +s = "Hello Asif" +# print(len(s)) +# print(max(s)) +# print(min(s)) +# print(max('')) +# print(sorted(s,reverse=True)) + +#more functions - capitalize,title,upper,lower,swapcase +s = "hello WoRld" +# print(s.capitalize()) +# print(s.title()) +# print(s.upper()) +# print(s.lower()) +# print(s.swapcase()) + +#count/index/find +# print(s.count('o')) +# print(s.count('l')) +# # print(s.index("7")) +# print(s.find('w')) +# print(s.find('')) + +#find the length + +# s = input("Enter a string:") + +# count = 0 +# for i in s: +# count +=1 +# print(i) + +# print("length is:",count) + +# s = input('Enter email:') + +# username = "" +# for i in s: +# if i =="@": +# break +# else: +# username +=i + +# print("username:",username) + +# s = input("enter a string:") +# c = input("enter a character:") +# count =0 +# for x in s: +# if x == c: +# count +=1 + +# print(c," count:",count) + +# s = input("enter the string:") +# c = input("enter the character to remove:") + +# str1 = "" + +# for x in s: +# if x ==c: +# continue +# else: +# str1+=x + +# print("modified string:",str1) From d330fd4eab0437e956d2da3c55cfdffe9c67d1a9 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Wed, 14 Jan 2026 13:19:03 +0600 Subject: [PATCH 099/115] operator codes added --- operators.py | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 operators.py diff --git a/operators.py b/operators.py new file mode 100644 index 0000000..04e66f9 --- /dev/null +++ b/operators.py @@ -0,0 +1,115 @@ +print("Operators in python") + +#operators - symbols to carry out calculations +# a(operand) +(operator) b(operand) + +# a = 100 +# b = 50 +# sum = a + b #150 +# sub = a - b #50 +# multi = a * b #5000 +# div = a / b #2.0 +# exp = a ** b #large number +# floor_div = a // b #2 +# mod = a % b #0 + +# print(sum) +# print(sub) +# print(multi) +# print(div) +# print(exp) +# print(floor_div) +# print(mod) +#operator precedence-(),**,/ * % //,+- +print(20 + (3*4) - 2 *4 /4) + + +#relational operator - to compare between two things +# print(4>5) #false +# print(10<34) #true +# print(4>=4) #true +# print(5<=4) #false +# print(4 == 4) #true +# print(10 !=30) #true + +#logical -and,or,not +# print(12 and "Asif") +# print("" and 200) + +# print(12 or 13 or 23) +# print("" or 20 or 23) + +# print(not 12) + +#bitwise operator - bit by bit kaj kore +# print( 10 & 4) +# print(5 & 5) +# print(10 ^ 5) +# print(~4) + +#assignment operator- =+,=-,*=,/= +# a = 10 +# b = 5 +# a+=b +# print(a) +# a-=b +# print(a) +# a*=b +# print(a) + +# a /=b +# print(a) +# a %=b +# print(a) +# # a++ +# ++a +# print(a) +# print(a) + +#membership operator-in,not in +l = [1,2,3,4] +str1 = "Hello World" +t = ("Asif",25,True) + +# print(1 in l) +# print(10 not in l) +# print("A" in str1) +# print("o" not in str1) +# print(25 in t) +# print(False not in t) + +# num = int(input("Enter a number:")) +# dig1 = num % 10 +# num = num //10 +# dig2 = num % 10 +# num = num //10 +# dig3 = num %10 +# num = num //10 +# dig4 = num % 10 +# print(dig1+dig2+dig3+dig4) + + + + + + + + +#operator tasks +# ctc = int(input("Enter ctc:")) +# hra = ctc * 0.1 +# da = ctc * 0.05 +# pf = ctc * 0.03 +# salary = ctc - (hra + da + pf) +# if ctc<5: +# salary = salary +# elif ctc >=5 and ctc < 10: +# tax = ctc*0.1 +# salary = salary - tax +# elif ctc >=10 and ctc <20: +# tax = ctc *0.2 +# salary = salary - tax +# elif ctc >=20: +# tax = ctc * 0.3 +# salary = salary - tax + From eabea101da16c92f2e141553093877ad6ba2dd96 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Thu, 15 Jan 2026 00:02:32 +0600 Subject: [PATCH 100/115] tasks added --- operators.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/operators.py b/operators.py index 04e66f9..234475a 100644 --- a/operators.py +++ b/operators.py @@ -88,7 +88,37 @@ # dig4 = num % 10 # print(dig1+dig2+dig3+dig4) +#identity operator- is,is not +# print(12 is 12) +# print(12 is not 12) +#if else in python +#login process +# email = input("Enter you email:") +# password = input("Enter password:") + +# if email =="asif@gmail.com" and password =="1234": +# print("login successful") +# elif email == "asif@gmail.com" and password !="1234": +# print("Wrong password") +# password = input("Enter password:") +# if password =="1234": +# print("Login success") +# else: +# print("Wrong info") + +#find the min of 3 given numbers +num1 = int(input("Enter a number:")) +num2 = int(input("Enter a number:")) +num3 = int(input("Enter a number:")) + +if num1 < num3 and num1 < num2: + print(f"{num1} is the min") +elif num2 < num1 and num2 < num3: + print(f"{num2} is the min") +else: + print(f"{num3} is the min") + @@ -113,3 +143,21 @@ # tax = ctc * 0.3 # salary = salary - tax +#problem - 2 +# angle1 = float(input("enter a angle:")) +# angle2 = float(input("enter a angle:")) +# angle3 = float(input("enter a angle:")) + +# if (angle1+angle2) > angle3 or (angle2 + angle3) >angle1 or (angle3+angle1) >angle2: +# print("Can be a triangle") +# else: +# print("Cannot form a triangle") + +# sum_of_angles = angle1 + angle2 + angle3 +# if sum_of_angles == 180 and (angle1>0 and angle2>0 and angle3>0): +# print("Can be a triangle") +# else: +# print("Can't be a triangle") + +# cost = float(input("Enter cost price:")) +# sell = float(input("Enter selling price:")) From 3893855229a8c64923de3f3df992fc31b100aef8 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Thu, 15 Jan 2026 11:24:14 +0600 Subject: [PATCH 101/115] oop codes added --- oop1.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 oop1.py diff --git a/oop1.py b/oop1.py new file mode 100644 index 0000000..20cd87c --- /dev/null +++ b/oop1.py @@ -0,0 +1,41 @@ +print("Python object oriented programming") + +# l = [1,2,3] +# l.upper() + +#oop - class ,object,encapsulation,inheritance,polymorphism,abstraction + +# l = [1,2,3] +# print(type(l)) + +#class - property/attribute - blueprint of object +# class Student: +# def __init__(self) + +# st1 = Student() +# class Human: +# def __init__(self): +# print("Human object created") + +# asif = Human() + +# class Student: +# def __init__(self): +# self.name = "Asif" +# self.age = 25 +# self.course ="CSE" +# print(f"name:{self.name} age:{self.age} course:{self.course}") + +# stu_asif = Student() + +# class Student: +# def __init__(self,name,age,course): +# self.name = name +# self.age = age +# self.course = course +# print(f"name:{self.name} age:{self.age} course:{self.course}") + +# student1 = Student("Probin",24,"EEE") +# student2 = Student("Asif",25,"CSE") +# print(type(student1)) + From f1bb9886147393be8611f82ebbc15742a9ad1924 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Fri, 16 Jan 2026 12:03:42 +0600 Subject: [PATCH 102/115] oop codes added --- oop1.py | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/oop1.py b/oop1.py index 20cd87c..0ba8af0 100644 --- a/oop1.py +++ b/oop1.py @@ -39,3 +39,110 @@ # student2 = Student("Asif",25,"CSE") # print(type(student1)) +# class Atm: +# def __init__(self): +# self.balance = 0 +# self.pin ="" +# self.menu() + +# def menu(self): +# user_input=input("""Hi +# How can i help you? +# 1.Press 1 to create pin +# 2.Press 2 to change pin +# 3.Press 3 to debit balance +# 4.Press 4 to withdraw balance +# 5.Press 5 to check balance +# 6.Press 6 to exit\n""") + +# if user_input =="1": +# self.create_pin() +# elif user_input =="2": +# self.change_pin() +# elif user_input =="3": +# self.credit_balance() +# elif user_input =="4": +# self.withdraw_balance() +# elif user_input =="5": +# self.check_balance() +# else: +# self.menu() + +# self.menu() + +# def create_pin(self): +# user_pin = input("Enter pin:") +# self.pin = user_pin +# print("Pin created successfully") + +# def change_pin(self): +# user_pin = input("Enter your pin:") +# if user_pin == self.pin: +# new_pin = input("Enter new pin:") +# self.pin = new_pin +# print("New pin created") +# else: +# print("Wrong pin") + +# def credit_balance(self): +# user_pin = input("Enter your pin:") +# if user_pin == self.pin: +# balance = int(input("Enter your balance:")) +# self.balance = balance +# print("Balance credited successfully") +# else: +# print("Wrong pin") + +# def withdraw_balance(self): +# user_pin = input("Enter your pin:") +# if self.pin == user_pin: +# withdraw_balance = int(input("Enter amount to withdraw:")) +# if withdraw_balance < self.balance: +# self.balance = self.balance - withdraw_balance +# print(f"{withdraw_balance} withdrawn successfully") +# print(f"current balance is:{self.balance}") +# else: +# print("You don't have thar much balance") + +# else: +# print("Wrong pin") + + +# def check_balance(self): +# print("current balance is {}".format(self.balance)) + + +# obj = Atm() + +# class Student: +# def __init__(self,name,age,course): +# self.name = name +# self.age = age +# self.course = course + +# def read(): +# print() + +# class Car: +# def __init__(self): +# print(id(self)) + +# def __str__(self): +# print("Object got created") + +# bmw = Car() +# print(id(bmw)) +# # print(bmw) + +# class Car: +# def __init__(Self,name,model): +# Self.name = name +# Self.model = model + +# def __str__(Self): +# return f"Car name:{Self.name} model:{Self.model}" + +# bmw =Car("BMW","X6") +# print(bmw) +# audi = Car("Audi","R8") +# print(audi) \ No newline at end of file From 4bec6528598e5907669a3b92998d69bf271a3721 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Mon, 19 Jan 2026 14:30:36 +0600 Subject: [PATCH 103/115] basics tasks added --- basics.py | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 92 insertions(+), 2 deletions(-) diff --git a/basics.py b/basics.py index c7cc6fd..1f71948 100644 --- a/basics.py +++ b/basics.py @@ -80,7 +80,97 @@ # print("23"+23) -print("Data","Science","Mentorship","Progran","By","CampusX",sep='-',end="\n") +# print("Data","Science","Mentorship","Progran","By","CampusX",sep='-',end="\n") -# celcius = input(float("Enter celcius value:")) +# celcius = float(input("Enter celcius value:")) +# farenheit = (9 * celcius)/5 + 32 +# print("In farenheit:",farenheit) + +# num1 = int(input("enter a number:")) +# num2 = int(input("enter another number:")) + +# temp = num1 +# num1 = num2 +# num2 = temp +# print(f"After swapping:{num1},{num2}") + +# x1 = float(input("Enter x1:")) +# y1 = float(input("Enter y1:")) +# x2 = float(input("Enter x2:")) +# y2 = float(input("Enter y2:")) + +# euc_distance = ((x1-x2)**2 + (y1-y2)**2)*0.5 +# print("distance is :",euc_distance) + +#simple interest calculator +# p = int(input("Enter amount:")) +# r = float(input("Enter rate of interest:")) +# t = int(input("Enter time")) + +# interest = p * r * t +# print("Interest is:",interest-p) + +# heads = int(input("Heads-> ")) +# legs = int(input("Legs ->")) + + +#literal - constant value that is stored in variable +a = 2 +a = 0b1010 + +# print(a) + +# b = 0o456 +# print(b) +# c =0xA234 +# print(c) + +# f1 = 10.34 +# f2 = 12e-3 +# f3 = 1e5 +# print(f1,f2,f3) + +# complex1 = 4 + 3j +# print(complex1) + +# a = None +# print(a) +# b = True +# print(b +3) + + +#question no 6 +# heads = int(input("heads->")) +# legs = int(input("legs->")) + +# dogs = (legs - 2 * heads)/2 +# chickens = heads - dogs + +# print() + +#question 7 +# num = int(input("Enter n :")) +# sum = (num * (num+1)*(2*num+1))/6 +# print("Sum is:",sum) + +#question 8 +# num1 = int(input("enter 1st num:")) +# num2 = int(input("enter 2nd num:")) +# n = int(input("Enter n:")) +# diff = num2 - num1 + +# a = num1 + (n-1)*diff +# print(a) + +#question 9 + +# x1 = int(input("Enter x1:")) +# y1 = int(input("Enter y1:")) +# x2 = int(input("Enter x2:")) +# y2 = int(input("Enter y2:")) + +# num = x1 * y2 + y1 * x2 +# den = y1 * y2 + +# print("{}/{}".format(num,den)) From d6fa5ae2aa3d27be64fb825e9f035574ae890865 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Mon, 19 Jan 2026 21:16:55 +0600 Subject: [PATCH 104/115] basics all done --- basics.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/basics.py b/basics.py index 1f71948..e3b167f 100644 --- a/basics.py +++ b/basics.py @@ -174,3 +174,11 @@ # print("{}/{}".format(num,den)) +#question 10 +# print("Dimentions of the milk tank") +# H = int(input("H = ")) +# L = int(input("L = ")) +# B = int(input("B = ")) +# print("Dimensions of the glass") +# h = int(input("h = ")) +# r = int(input("r = ")) From 54a0515c8fd2b49c7850e3176e3266bbaf1d75e8 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Mon, 19 Jan 2026 21:38:49 +0600 Subject: [PATCH 105/115] operators codes added --- operators.py | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/operators.py b/operators.py index 234475a..3c7688a 100644 --- a/operators.py +++ b/operators.py @@ -108,18 +108,18 @@ # print("Wrong info") #find the min of 3 given numbers -num1 = int(input("Enter a number:")) -num2 = int(input("Enter a number:")) -num3 = int(input("Enter a number:")) - -if num1 < num3 and num1 < num2: - print(f"{num1} is the min") -elif num2 < num1 and num2 < num3: - print(f"{num2} is the min") -else: - print(f"{num3} is the min") +# num1 = int(input("Enter a number:")) +# num2 = int(input("Enter a number:")) +# num3 = int(input("Enter a number:")) + +# if num1 < num3 and num1 < num2: +# print(f"{num1} is the min") +# elif num2 < num1 and num2 < num3: +# print(f"{num2} is the min") +# else: +# print(f"{num3} is the min") - +#menu driven calculator @@ -161,3 +161,12 @@ # cost = float(input("Enter cost price:")) # sell = float(input("Enter selling price:")) + +# if cost > sell: +# print("Loss") +# elif cost < sell: +# print("Profit") +# else: +# print("Even") + +#problem 4 From 0e4a2553d4ea795b62ced9fc44d6541595e0725f Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Thu, 22 Jan 2026 11:34:12 +0600 Subject: [PATCH 106/115] list codes added --- list.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 list.py diff --git a/list.py b/list.py new file mode 100644 index 0000000..daa6be6 --- /dev/null +++ b/list.py @@ -0,0 +1,42 @@ +print("List and methods") + +# l = [10,"Asif",25.99,True] +# print(id(l[0])) +# print(id(l[1])) +# print(id(l[2])) +# print(id(l[3])) + +#characteristics of list +# l = [1,2,3,4] +# print(l[1]) +# print(l[-1]) +# print(l[0]) + +# l = [12,34,22] +# l[0] = 10 +# print(l) + +# l = [12,"Asif",23.44] +# print(l) + +# l = [12,34,12] +# print(l) +# l.append(100) +# print(l) +# l = [12,10,[12,12]] +# print(l) + +# l = [(1,2),"Asif",{"name":"Asif"}] +# print(l) + +# ulti_list = [10,[20,30],"Asif",True,(5,6),{"age":24}] +# print(ulti_list[0]) +# print(ulti_list[-1]) +# ulti_list[0] = 100 +# print(ulti_list) +# l1 = [12,3,43] +# l2 = [12,3,43] +# print(l1 == l2) +# print(l1 is l2) + +#creating a list From 515c77ed48fc51b45c1fb48fa482616657b27a34 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Thu, 22 Jan 2026 12:07:13 +0600 Subject: [PATCH 107/115] some codes added --- list.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/list.py b/list.py index daa6be6..c743780 100644 --- a/list.py +++ b/list.py @@ -40,3 +40,45 @@ # print(l1 is l2) #creating a list +# l1 = [] +# print(l1) +# l2 = ["Asif","Probin","Hasan"] +# print(l2) +# l3 = [12,34,[1,2],[2,3]] +# print(l3) +# print(l3[2][0]) +# l4 = ["Asif",24,True] +# print(l4) +# l5 = [[1,2,[5,6]],[0,10,[20,30]]] +# print(l5[0][2][0],l5[1][2][1]) +# li = list("Asif") +# print(li) +# l1 = list((12,34,55)) +# print(l1) +# l2 = list([12,34,[1,2]]) +# print(l2) +#accessing items from a list +l = [10,20,30,40,50] +# print(l[0]) +# print(l[3]) +# print(l[-1]) +# print(l[len(l)-4]) +# print(l[::]) +# print(l[::-1]) +# print(l[1:4]) +# print(l[0:3]) +# print(l[-5:-1:]) + +#adding items on a list-append,insert,extend +# l = [10,20,30,40,50,60] +# print(l.append(70)) +# print(l) +# l.extend("Asif") +# print(l) +# l.extend([1,2,3]) +# print(l) +# l.insert(0,'Asif') +# print(l) + + + From 5324bbf95bb143dcf036ab1cd42282b6551bd2e8 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Fri, 23 Jan 2026 22:14:03 +0600 Subject: [PATCH 108/115] added tuple codes --- tuples.py | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/tuples.py b/tuples.py index 0753a59..24c3f07 100644 --- a/tuples.py +++ b/tuples.py @@ -20,3 +20,115 @@ # print(t7) # t8 = tuple([1,2,3,5]) # print(t8) + +#accessing tuples - indexing,slicing +t1 =("Asif",24,19.99,True,10,20) +# print(t1[0]) +# print(t1[-1]) +# print(t1[-3]) +# print(t1[::]) +# print(t1[1:3]) +# print(t1[::-1]) +# t1[6] ="A" + +#editing items +t1 = (12,3,4,2,23,22) +# t1[4] = 22 + +#adding r editing,deleting korte gele type error dekhai +#deleting items +# del t1[2] +# del t1 +# print(t1) +#operation on tuple +#arithmetic - + ,* +t1 = (1,2,3) +t2 = (1,2,3) +# print(t1+t2) +# print(t1*3) +#membership - in,not in +# print(1 in t1) +# print(10 not in t1) +# print(5 in t2) +# print(1 not in t2) +# print(t1 == t2) +# print(t1 is t2) +# for i in t1: +# print(i) + +# t1 = (1,2,3,(10,20),(30,40),(50,60)) +# for i in t1: +# if isinstance(i,tuple): +# for j in i: +# print(j) +# else: +# print(i) + +#tuple functions - max,min,len,sorted,sum +t1 =(1,2,3,4,5,6) +t2 =("Asif",24,True,19.99) +# print(max(t1)) +# print(max(t2)) +# print(min(t1)) +# print(min(t2)) +# print(len(t1)) +# print(len(t2)) +# print(sorted(t1,reverse=True)) +# print(sorted(t2)) +# print(sum(t1)) + + +#tuple revise +# tu = (12,34,22) +# tu[0] = 10 +# print(tu) +tu =("Asif",24,12,12) +# print(tu[0]) +# print(tu[1]) +# print(tu[2]) +# print(tu[3]) + +#creating a tuple +# t1 = () +# print(t1,type(t1)) +# t2 = ("Asif") +# print(t2,type(t2)) +# t3 = (23,) +# print(t3,type(t3)) + +# #homo +# t4 = (10,20,30,40) +# print(t4) +# #hetaro +# t5 = ("Asif",24,True,[1,2,3]) +# print(t5) +# #2D +# t6 = ("Asif",24,(1,2)) +# print(t6) +# #tuple constructor +# t7 = tuple("Asif") +# print(t7) +# t8 = tuple((10,20,30)) +# print(t8) + +#accessing items-indexing,slicing +t1 = ("Asif",24,True,[1,2,3]) +# print(t1[0]) +# print(t1[-1]) +# print(t1[len(t1)-3]) + +# print(t1[::]) +# print(t1[::-1]) +# print(t1[0:3]) +# print(t1[-4:]) +# print(t1[-5:-4:-1]) + +#editing items-cannot edit because tuple is immutable +# tu = (10,20,30,40) +# tu[0] = 100 +# print(tu) +#adding items is not possible +# tu = (1,2,3,4) +# tu[10]=10 + +#deleting items From 77215f304ebf4d64cfe949987a30c6e1e76e4efb Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sat, 24 Jan 2026 01:01:31 +0600 Subject: [PATCH 109/115] tuple codes added --- tuples.py | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/tuples.py b/tuples.py index 24c3f07..621c2d3 100644 --- a/tuples.py +++ b/tuples.py @@ -132,3 +132,61 @@ # tu[10]=10 #deleting items +# t = (10,20,30,40) +# del t +# print(t) + +#operations on tuple +t1 = (10,20,30) +t2 = (10,20,30) +# print(t1 + t2) +# # print(t1 * t2) +# print((10,20)* 5) +# print(t1 == t2) +# print(t1 == t2) +# print(5 in t1) +# print(10 in t1) +# print(5 not in t1) +# for i in t1: +# print(i) + +#tuple functions- max/sum/min/max/len/sorted +# t1 = (12,3,4,2,5) +# t2 = ("Asif","Probin","Emon") +# print(len(tu)) +# print(max(t1)) +# # print(max(t2)) +# print(min(t1)) +# # print(min(t2)) +# print(sum(t1)) +# # print(sum(t2)) +# print(sorted(t1,reverse=True)) +# print(sorted(t2)) + +# print(t1.count(2)) + +# t1 = (10,20,30,40,30) +# print(t1.count(30)) +# print(t1.index(50)) + +t1 = (10,20,("Asif","Probin"),(1,2,3),(20,30,40)) +# for i in t1: +# for j in t1: +# if isinstance(j,tuple): +# print(j) +# print(i) +# for item in t1: +# if isinstance(item,tuple): +# for j in item: +# print(j) +# else: +# print(item) +# t2 = ("Asif",(10,20),(1,2,3),[5,10,15]) +# for i in t2: +# if isinstance(i,tuple or list): +# for j in i: +# print(j) +# else: +# print(i) + +#list vs tuple \ No newline at end of file From cb01f8b2ab31a55a1564751145fd69a05e94d611 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sun, 25 Jan 2026 21:52:16 +0600 Subject: [PATCH 110/115] basics done --- basics.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/basics.py b/basics.py index e3b167f..2e8f7d6 100644 --- a/basics.py +++ b/basics.py @@ -182,3 +182,32 @@ # print("Dimensions of the glass") # h = int(input("h = ")) # r = int(input("r = ")) + +#literals +# int_val = 103343 +# bin_val = 0b1001 +# dec_val = 0o234 +# hex_val = 0xA23 +# print(bin_val,type(bin_val)) +# print(dec_val,type(dec_val)) +# print(hex_val,type(hex_val)) + +# f1 = 1232.4323 +# f2 = 2232e2 +# f3 = 232e-3 +# print(f1,type(f1)) +# print(f2,type(f2)) +# print(f3,type(f3)) + +# a = 7 + 4j +# b = complex(3,4) +# print(a,type(a),b,type(b)) + +# bool1 = True +# bool2 = False +# print(bool1 + 4) +# print(bool2 - 4) + +a = None +print(a,type(a)) +a = 100 From 0aa51b7ea272dd5e934c2e8e675f142085452849 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Wed, 18 Feb 2026 12:09:40 +0600 Subject: [PATCH 111/115] string codes added --- string.py | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) diff --git a/string.py b/string.py index 2eead0a..39ede20 100644 --- a/string.py +++ b/string.py @@ -141,3 +141,128 @@ # str1+=x # print("modified string:",str1) + + +#string revise +# s1 = 'Hello Asif' +# s2 = "Hello Python" +# s3 = """Hi +# i am asif""" +# print(s1,s2,s3) +# print("Hello I am 24 year's old") +# print('Hello "Probin ') +# s1 = str(2+3j) +# print(s1) + +#accessing string - index,slicing +s1 = "Hello Bangladesh" +# print(s1[0]) +# print(s1[-4]) +# print(s1[len(s1)-3]) +# print(s1[1:4]) +# print(s1[::-1]) +# print(s1[::]) +# print(s1[:4]) +# print(s1[-1:-5:-1]) + +#string is immutable - can't edit the string +s1 = "Hello Bangladesh" +# s1[0] = "As" +# print(s1) +# s1[1:3] = "Asif" +# print(s1[0]) +# del s1[0] +# del s1 +# print(s1) +#operations on string +#arithmetic - +/* +s1 = "Hello" +# print(s1*3) +# print(s1 + "Asif" + 23) +# print("Mumbai"+"Delhi") +# print("Asif"+"Asif") +#relational - <,<=,>=,>,==,!= +# print("Asif">"Himel") +# print("Asif"<"probin") +# print("Boss" == "Boss") +# print("Boss">"Asif") +# print("Asif"!="asif") +# print("Cat">"Catch") +# print("cat">"CAT") +#string formatting +# name = "Asif" +# age = 24 +# print(f"My name is {name} and age is {age}") +# str1 ="My name is {} and age is {}".format(name,age) +# print(str1) + +# print("Asif" and "Hasan" and "Probin") +# print("" and "Asif" and "9") +# print("Asif" or False) +# print("" or "AS") +# print(not "Asif") +# print(not "") +# for i in "Hello World": +# print(i) + +# for i in range(1,11): +# print(f"Hello World {i}") + +#membership operator - in,not in +# print("H" in "Hello") +# print("D" in "delhi") +# print("a" not in "Asif") + +#common function - len,max,min,sorted +s1 = "hello world" +# print(len(s1)) +# print(max(s1)) +# print(min(s1)) +# print(sorted(s1,reverse=True)) +# print(s1.capitalize()) +# print(s1.title()) +# print(s1.upper()) +# print(s1.lower()) +# print(s1.swapcase()) +# print(s1.count("o")) + +#find the length of a given string +# s = input("Enter a string:") +# counter = 0 +# for i in s: +# counter += 1 + +# print(f"length of string is : {counter}") + +# email = input("Enter your email:") + +#string revise + +# str1 = 'Hello Asif' +# str2 = "Hello Python" +# str3 ="""Multiline +# string""" +# print(str1,str2,str3) +# print("Asif 's") +# print('Asif"ssf') +# str1 = str("Asif") +# print(str1) +s1 = "Hello Python" +# print(s1[4]) +# print(s1[-4]) +# print(s1[len(s1)-3]) +#slicing - [::] +# print(s1[1:5]) +# print(s1[::-1]) +# print(s1[::]) +# print(s1[:5]) +# print(s1[-3:-5:-1]) + +#s1[0] ="A" +# s2 = s1[0:4] +# print(s2) +# s = "Asif" +# # del s[0] +# del s +# print(s) +#operations on string From 77bacc11e19311f1a89b5b96b2a56eabe5fbe1be Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Thu, 19 Feb 2026 14:16:29 +0600 Subject: [PATCH 112/115] some codes added --- list.py | 171 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ string.py | 72 +++++++++++++++++++++++ 2 files changed, 243 insertions(+) diff --git a/list.py b/list.py index c743780..157f7ed 100644 --- a/list.py +++ b/list.py @@ -80,5 +80,176 @@ # l.insert(0,'Asif') # print(l) +# l1 = [10,20,30,40] +# l1.insert(1,200) +# l1.insert(-1,[1,2]) +# print(l1) +# l1.append(100) +# print(l1) +# l1.extend("Asif") +# print(l1) + +#editing items on a list +# l = [1,2,3,4,5,6,7] +# l[0] = [12,34] +# print(l) +# l[1] = 100 +# print(l) +# l[0:3]=[1,2,3] +# print(l) + +#deleting items from a list - pop,del,remove,clear +l = [10,20,30,50,40] +# l.pop() +# print(l) +# l.pop(0) +# print(l) +# del l[0] +# print(l) +# del l[0:2] +# print(l) +# print(l.pop()) +# l.remove(20) +# print(l) +# print(l.remove(40)) +# print(l) +# l.clear() +# print(l) +# print(l) +# del l +# print(l) +# del l[0] +# print(l) +# del l[0:2] +# print(l) +# l.pop() +# print(l) +# l.pop(1) +# print(l) +# l.remove(50) +# print(l) +# l.clear() +# print(l) + +#operation on list +#arithmetic - +,* +# l1 = [1,2,3] +# l2 = [4,5,6] +# print(l1+l2) +# print(l1*4) + +#list revise +# l = [12,"Asif",True,10,[1,2,3]] +# print(id(l[0])) +# print(id(l[1])) +# print(id(l[2])) + +# l[0] = 10 +# print(l) +#nested list +# l = [10,20,30,[1,2,3,[5,6]]] +# print(l[3][3][1]) +# l = list([1,2,3,4]) +# print(l) + +#accessing list items- index,slicing +l1 = [10,"Asif",True,(1,2,3)] +# print(l1[0]) +# print(l1[-2]) +# print(l1[len(l1)-3]) + +# print(l1[::-1]) +# print(l1[::]) +# print(l1[1:3]) +# print(l1[-1:-3:-1]) + +#adding items to a list-append,extend,insert +list1 = [10,20,30,40] +# list1.append(50) +# list1.append([1,2,3]) +# list1.append(("Asif")) +# list1.append("Asif") +# print(list1) +# list1.extend("Asif") +# print(list1) +# list1.extend([1,2,3]) +# print(list1) +# list1.insert(0,"Asif") +# print(list1) + +#editing items on a list +#list is mutable - can change any particular value +# l = [10,"Asif",24.5,True,1,2] +# l[0] = 100 +# print(l) +# l[1:3]=["Asif"] +# print(l) + +#deleting items from a list +# del l[0] +# print(l) +# del l[1:3] +# print(l) +# del l +# print(l) + + + + +#problem 1 +# list1 = ["M","na","i","Kh"] +# list2 = ["y","me","s","an"] +# list3 = [] + +# for i in range(0,len(list1)): +# item = [] +# item.append(list1[i]) +# item.append(list2[i]) +# list3.append(item) + +# print(list3) + +#problem - 2 +# list1 = [10,20,[300,400,[5000,6000],500],30,40] + +# for item in list1: +# if isinstance(i,list): +# for j in i: + + + +#problem - 4 +# list1 = [1,2,3,4,5,6] +# list2 = [] +# sum = 0 +# for i in list1: +# sum +=i +# list2.append(sum) + +# print(list2) + +#problem - 3 +# candy_list = ['Jelly Belly','Kit Kat','Double Bubble','Milky Way','Three Musketeers'] +# no_of_items = [10,20,34,74,32] + +# for i in range(0,len(candy_list)): +# print(f"{candy_list[i]}- {no_of_items[i]}") + +#problem - 10 +# list1 = ['campusxIs', 'bestFor', 'dataScientist'] +# for item in list1: +# for char in item: +# if char.upper() + +#problem - 11 +# list1 = [1,2,3,4,5,1] +# list2 = [2,3,5,7,8] +# list3 = [] +# for i in range(0,len(list1)): +# if list1[i] == list2[i]: +# list3.append(list1[i]) +# else: +# list3.append(list2[i]) +#list revise diff --git a/string.py b/string.py index 39ede20..6129aff 100644 --- a/string.py +++ b/string.py @@ -266,3 +266,75 @@ # del s # print(s) #operations on string +# print("Asif"+" "+"Asif") +# print("Asif"*3) +# print("Asif">="asif") +# print("Dhaka"<"Pune") +# print("cat">"catch") +#print("Asif"=="asifa") +# print("Asif"and"Asifa") +# print("sif"and"") +# print("" and "Asif") +# print("Asif"or"Shifa") +#print(not 23) +# s1 = "Hello Asif" +# for i in s1: +# print(i) +#print("D" in "Deshi") +# print(12 and 23 and 34) +# print(23 and "" and 34) +#common functions-min,max,len,sorted +# s1 = "Hello Asif" +# print(len(s1)) +# print(max(s1)) +# print(min(s1)) +# print(sorted(s1,reverse=True)) +# s1 = "hello World" +# print(s1.capitalize()) +# print(s1.upper()) +# print(s1.lower()) +# print(s1.title()) +# print(s1.swapcase()) +# s2 = "Hello Python" +# print(s2.swapcase()) +# print(s2.lower()) +# print(s2.upper()) +# print(s2.title()) +# print(s2.capitalize()) +#string formatting- format,f-string +# name = "Asif" +# age = 25 +# print("My name is {} and age is {}".format(name,age)) +# print(f"My name is {name} and age is {age}") +#functions to check if a string meets a criteria +# s = "HelloWorld" +# print(s.isalnum()) +# s = "!123Asif" +# print(s.isalnum()) + + + + + +# email = "haque.mdasif1501@gmail.com" +# username ="" +# for i in email: +# if i =='@': +# break +# else: +# username +=i +# print("Username :{}".format(username)) + +#count the frequency of a particular character in a string +# s = "hello how are you" +# char = 'h' +# count = 0 +# for i in s: +# if i == char: +# count +=1 + +# print(f"Frequency:{count}") + +#remove a particular character from a string +# s = input("Enter a string:") +# char = input("Enter a char:") From 87ba6bb6c719c327905fca72d9f4a6c12848d843 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Thu, 19 Feb 2026 14:17:07 +0600 Subject: [PATCH 113/115] some codes added --- operators.py | 195 +++++++++++++++++++++++++++++++++++++++++++++++++-- strings.py | 7 ++ 2 files changed, 197 insertions(+), 5 deletions(-) diff --git a/operators.py b/operators.py index 3c7688a..3ae8b03 100644 --- a/operators.py +++ b/operators.py @@ -22,7 +22,7 @@ # print(mod) #operator precedence-(),**,/ * % //,+- print(20 + (3*4) - 2 *4 /4) - +# print(2**3**2) #relational operator - to compare between two things # print(4>5) #false @@ -31,6 +31,8 @@ # print(5<=4) #false # print(4 == 4) #true # print(10 !=30) #true +# print(2 == 2.00) + #logical -and,or,not # print(12 and "Asif") @@ -119,9 +121,17 @@ # else: # print(f"{num3} is the min") -#menu driven calculator - - +#match case statement +# x = "monday" +# match x: +# case "Sunday": +# print("Today is sunday") +# case "Monday": +# print("Today is monday") +# case "Tuesday": +# print("Today is tuesday") +# case _: +# print("Invalid day") @@ -169,4 +179,179 @@ # else: # print("Even") -#problem 4 +#problem 4 - menu driven program +# while True: +# user_input = input(""" +# 1.cm to ft +# 2.km to miles +# 3.USD to BDT +# 4.exit\n""") + +# if user_input == '1': +# cm = float(input("Enter cm value:")) +# fit = cm /30.48 +# print(f"{cm} cm = {fit} ft") +# elif user_input =="2": +# km = float(input("Enter km value:")) +# miles = km /1.61 +# print(f"{km} km = {miles} miles") +# elif user_input == "3": +# usd = float(input("Enter usd:")) +# bdt = usd * 122.27 +# print(f"{usd} usd = {bdt} bdt") +# else: +# print("Exited") +# break + +#problem 5 - fibonacci sequence +# ini = 0 +# mid = 1 +# for i in range(1,10): + + +#problem 6 +# n = int(input("Enter a number:")) +# fact = 1 +# for i in range(1,n+1): +# fact *= i + +# print(f"factorial of {n} is : {fact}") + +#problem 7 +# n = 76542 +# s ="" +# while n % 10 != 0: +# dig = n % 10 +# s +=dig +# n = n // 10 +# print(s) + +#problem 8 +# N = int(input()) +# sum = 0 +# i = 0 +# while i < N : +# if i % 5 == 0: +# continue +# else: +# sum += i + +# i +=1 + + + +#control flow +#operators +# exp1 = 34.5 + 45 +# #arithmetic(+,-,*,/,%,//,**) +# add = 234.5 + 45 +# sub = 23 - 45.0 +# multi = 34 * 45.0 +# div = 45 / 4 +# mod = 34 % 5 +# flo_div = 23 // 10 +# print(add,sub,multi,div,mod,flo_div) +#precedence - (), **,* / // %,+ - +#relational operator - ><>=<=.==,!= +# print(45 > 33) +# print(34 < 23) +# print(34>=45) +# print(44<=23) +# print(12 == 12) +# print(12 is 23) +# print(12.0 == 12) +# l1 = [12,3,4] +# l2 = [12,3,4] +# print(l1 is l2) +# print(l1 == l2) +s1 = "Asif" +s2 = "Asif" +# print(s1 == s2) +# print(s1 is s2) +t1 =(1,2,3) +t2 =(1,2,3) +# print(t1 == t2) +# print(t1 is t2) +#assignment - +=,-= +# a = 30 +# a+=30 +# print(a) +# a-=40 +# print(a) +# a*=30 +# print(a) +# a /= 15 +# print(a) +# a %= 3 +# print(a) +#logical operator - and,or,not +# print(true and true) +# print("Asif" and "23") +# print("" and 23) + +# print(23 or 12) +# print("" or "Asif") + +#membership operator-in,not in +# print(4 in [1,2,3]) +# print(5 not in (1,234)) +#if else + +#palindrome number +# num = int(input("Enter a number:")) +# num_str = str(num) +# num_rev = num_str[::-1] +# if num_str == num_rev: +# print("Palindrome") +# else: +# print("Not palindrome") + + +#sum of digits +# num = int(input("Enter a number:")) +# sum = 0 +# while num % 10 !=0: +# dig = num % 10 +# sum += dig +# num = num // 10 +# print(sum) + +#count even and odd digits +# num = int(input("Enter a number:")) +# even = 0 +# odd = 0 +# while num % 10 !=0: +# dig = num % 10 +# if dig % 2 ==0: +# even += 1 +# else: +# odd += 1 +# num = num // 10 +# print("Even digits:{}".format(even)) +# print("Odd digits:{}".format(odd)) + +#largest of 3 numbers +# num1 = int(input("Enter a number:")) +# num2 = int(input("Enter a number:")) +# num3 = int(input("Enter a number:")) +# if num1 > num2 and num1 > num3: +# print(f"{num1} is the largest") +# elif num2 > num3: +# print(f"{num2} is the largest") +# else: +# print(f"{num3} is the largest") + +#electricity bill calculator +# units = float(input("Enter units:")) +# bill = 0 +# if units >=0 and units<=100: +# price = 5 +# bill_under_100 = units * 5 + +# if units >=101 and units <= 200: +# price = 7 +# bill_under_200 = bill_under_100 + + +#multiplication table of n +n = int(input("Enter :")) + diff --git a/strings.py b/strings.py index d08573d..796c146 100644 --- a/strings.py +++ b/strings.py @@ -39,4 +39,11 @@ # del s1 # print(s1) +#operation on string +# s1 = "Asif" +# s2 = "23" +# print(s1 + s2) +# print(s1 * 2) +# print("*" * 10) +#relational operator From 3684bcef1a169eb3f3c1002175ae1d82f461bf88 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sat, 28 Feb 2026 15:27:07 +0600 Subject: [PATCH 114/115] sets added --- sets.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 sets.py diff --git a/sets.py b/sets.py new file mode 100644 index 0000000..77cd6bc --- /dev/null +++ b/sets.py @@ -0,0 +1,32 @@ +print("sets") +#s1 = {12,34,10,"Asif",True} +#print(s1) +# print(s1) +# s1 = set() +# print(s1) + +#creating sets +s1 = {} +# print(s1,type(s1)) +s1 = set() +#print(s1,type(s1)) +s2 = {12,3,23,12} +# print(s2) +#s3 = {1,2,3,4,{1,2}} +s4 = {12,3,"Asif",True,(1,2,3)} +print(s4) + +# s5 = set([2,3,4,4,6433,3,53535,3]) +# s6 = set("Asif") +# print(s5,s6) + +# s1 = {1,2,3} +# s2 = {3,2,1} +# print(s1==s2) + +#accessing items +s1 = {"Asif",24,True,23.99} +# print(s1[0]) +# print(s1[0:3]) +# s1[0] = 10 + From 257aab3e649cb7b7de5cf8da510642ee07bb9cb8 Mon Sep 17 00:00:00 2001 From: asiflolcoder Date: Sat, 28 Feb 2026 15:28:02 +0600 Subject: [PATCH 115/115] codes added --- tuples.py | 190 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 189 insertions(+), 1 deletion(-) diff --git a/tuples.py b/tuples.py index 621c2d3..ad2a9fd 100644 --- a/tuples.py +++ b/tuples.py @@ -189,4 +189,192 @@ # else: # print(i) -#list vs tuple \ No newline at end of file +#list vs tuple +# import time + +# l = list(range(10000000)) +# t = tuple(range(1000000)) + +# start_time = time.time() + +# for i in l : +# a = i * 5 +# print("time taken for l:",time.time()-start_time) + +# start_time = time.time() +# for j in t: +# b = j * 5 +# print("time taken for t:",time.time()-start_time + +#memory +# import sys +# l = list(range(1000)) +# t = tuple(range(1000)) + +# print("Loop size:",sys.getsizeof(l)) +# print("Tuple size:",sys.getsizeof(t)) + +#tuple revise + +#special syntax - +# a,b,c = (10,20,30) +# # print(a,b,c) +# a,b = ("Asif",23,10) +# print(a,b) +# name,age,isStudent = ("Asif",25,True) +# print(isStudent) +# print(age) +# print(name) +# a = 1 +# b = 2 +# a,b = b,a +# print(a,b) + +#tuple tasks +# test_list = [(5,6),(5,7),(5,8),(6,10),(7,13)] +# new_list =[] +# for i in test_list: +# for j in test_list: +# if i[0] == j[0]: +# new_list.append() + +# t1 = (1,2,3,0) +# t2 = (0,1,2,3) + +# for i in t1: +# if t1[i] != t2[i]: + +# else: +# print(f"{t1} and {t2} are same") + +#question 4 + + +#tuple revise +t1 = (12,23,22,11,12) +# # print(t1) +# print(type(t1)) +# print(t1[0]) +# t2 = () +# print(t2) +# t3 = (23) +# print(t3,type(t3)) +# t4 =(12,) +# print(t4,type(t4)) +# t5 = ("Asif",24,True) +# print(t5) +# t6 = (12,3,42,("A","B")) +# print(t6) +# t7 = tuple("Asif") +# print(t7) + +#accessing a tuple +t1 = (10,20,"Asif",True,29.99) +# print(t1[3]) +# print(t1[-3]) +# print(t1[len(t1)-2]) + +# print(t1[1:4]) +# print(t1[::]) +# print(t1[::-1]) +# print(t1[:-4:-1]) +#t1[0] = 100 +# del t1[1] +# del t1 +# print(t1) + +#t1[5]=30 + +#operations on tuple +#rithmetic - +,* +# t1 = (12,2,23,21,"Asif") +# t2 =(10,20,39,True) +# print(t1+t2) + +# t1 =("Asif",24,True) +# print(t1*4) + +t1 = (10,20,30,40) +t2 = (10,20,30,40) +# print(t1 > t2) +# print(t1 == t2) +# print(t1 is t2) +# print(12 in t1) +# for i in t1: +# print(i) +# person = ("Asif",22,"Bangladesh") +# name,age,country = person +# print(f"Name:{name},Age:{age},Country:{country}") + +#tuple functions-len,max,min,sum,sorted +t1 = (10,20,30,40,50,10) +t2 = ("Asif",True,19.99) +# print(len(t1)) +# print(len(t2)) +# print(max(t1)) +# #print(max(t2)) +# print(min(t1)) +# print(sum(t1)) +# print(sum(t2)) +#print(sorted(t1)) +#print(sorted(t2,reverse=True)) + +# print(t1.count(10)) +#print(t1.count(100)) +# print(t1.index(100)) +numbers = (1,2,3,2,4,2,5) +# print(numbers.count(2)) +# count = 0 +# for i in numbers: +# if i == 2: +# count +=1 +# print(count) +# print(numbers.index(4)) +# index = -1 +# for i in numbers: +# if i != 4: +# index+=1 +# print(index) + +#tuple unpacking +# t1 = (10,20,30,40) +# name,age,num1,num2 = t1 +# print(name,age,num1,num2) +# a,c = (1,2,3) +# print(a,c) +# a = 20 +# b = 40 +# b,a = a,b +# print(a,b) +# t = (1,2,3,4,5) +# l +# t1 = tuple(l)= [] +# for i in t: +# l.append(i) +# l.append(10) +# print(l) +# print(t1) + +#tuple unpacking +# a,b,*others = (10,20,30,40,50) +# print(a,b,others) +# name,age,*country =("Asif",24,"Bangladesh","India","China") +# print(name,age,country) + +#zipping tuples +# t1 = (10,20,30,40,50) +# t2 = (100,200,300,99) +# print(tuple(zip(t1,t2))) + +#data = (1,2,(3,4),(5,6,7)) +# print(data[2][1]) +# print(data[3][2]) +# for i in data: +# if isinstance(i,tuple): +# for item in i: +# print(item) +# else: +# print(i) + +#find the second largest element +t = (10,5,20,8,15)