├── Class - 2 ├── first_program.py ├── first_program1.py ├── print_output.py └── second_program.py ├── Class 11 ├── file.py ├── prime.py └── readmy.txt ├── Class 12 ├── class_os.py ├── file3.py └── my_len.py ├── Class 14 ├── our_os.py └── our_sys.py ├── Class 3 └── class_3.py ├── Class 4 ├── List.py ├── List2.py └── String.py ├── Class 5 ├── dict.py ├── set.py └── tuple.py ├── Class 6 ├── if_else.py ├── if_else_2.py └── loop.py ├── Class 7 ├── ascii_using_for&while_loop.py ├── loop3.py └── print_1_five_times.py ├── Class 8 ├── adding_two_number.py ├── dynamic_solution.py ├── exception_handling.py ├── function.py ├── problem1.py ├── problem2.py └── simple_calculator.py ├── Class 9 ├── my_print_function.py └── number_guessing_game.py ├── README.md └── djang └── django first apps.txt /Class - 2/first_program.py: -------------------------------------------------------------------------------- 1 | import math 2 | a = 12 3 | # b = 5.5 4 | b = -6.3 5 | sum = a + b 6 | ''' 7 | print(sum) 8 | print(type(a)) 9 | print(type(b)) 10 | print(type(sum)) 11 | print(a) 12 | print(float(a)) 13 | print(b) 14 | print(int(b)) 15 | c = int(b) 16 | print(c) 17 | print(round(b)) 18 | ''' 19 | # print(math.ceil(b)) 20 | print(math.floor(b)) 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Class - 2/first_program1.py: -------------------------------------------------------------------------------- 1 | print('Hello world') -------------------------------------------------------------------------------- /Class - 2/print_output.py: -------------------------------------------------------------------------------- 1 | a = 7 2 | b = 3 3 | sum = a + b 4 | print(sum) # 10 5 | #print(a + ' + ' + b + ' = ' + sum) # error 6 | print(str(a) + ' + ' + str(b) + ' = ' + str(sum)) # 7 + 3 = 10 7 | print(a, '+', b, '=', sum) # 7 + 3 = 10 8 | print('{} + {} = {}'.format(a, b, sum)) # 7 + 3 = 10 9 | 10 | # input from user 11 | a = int(input('Enter first number: ')) 12 | b = int(input('Enter second number: ')) 13 | sum = a + b 14 | print(a, '+', b, '=', sum) # a + b = sum 15 | print('{} + {} = {}'.format(a, b, sum)) # a + b = sum 16 | 17 | ''' 18 | we learn today 19 | 1. Variable declaration, how its works? 20 | 2. Data type (int, float, str, bool) & Type cast 21 | 3. How to show different variable in print function ex: print(a, '+', b, '=', sum) 22 | 4. User input. ex: input('Enter something') 23 | ''' 24 | 25 | 26 | -------------------------------------------------------------------------------- /Class - 2/second_program.py: -------------------------------------------------------------------------------- 1 | a = 'Python programming class' 2 | print(type(a)) 3 | b = 'we used python 3' 4 | c = a + ' ' + b 5 | print(c) 6 | b = 12 7 | c = a + ' ' + str(b) 8 | print(c) 9 | 10 | a = '12' 11 | print(type(a)) 12 | b = 15 13 | d = int(a) + b 14 | print(d) 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Class 11/file.py: -------------------------------------------------------------------------------- 1 | 2 | f = open('E:\\Denary Computing Limited\\All Denary Logo\\4.jpg', 'rb') 3 | prime = f.read() 4 | f.close() 5 | 6 | f = open('C:\\Users\\noyon\\Desktop\\denary.noyon', 'wb') 7 | f.write(prime) 8 | f.close() 9 | 10 | -------------------------------------------------------------------------------- /Class 11/prime.py: -------------------------------------------------------------------------------- 1 | def is_prime(number): 2 | if number == 2: 3 | return True 4 | elif number == 4 or number <= 1: 5 | return False 6 | for i in range(3, round(number/2)+1, 2): 7 | if number % i == 0: 8 | return False 9 | return True 10 | user_input = int(input('Enter a number: ')) 11 | while True: 12 | if is_prime(user_input): 13 | print('{} is a prime number'.format(user_input)) 14 | else: 15 | print('{} is not a prime number.'.format(user_input)) 16 | c = input('Do you want to do it again?(y/n)-> ') 17 | if c == 'n': 18 | break 19 | else: 20 | user_input = int(input('Enter a number: ')) 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Class 11/readmy.txt: -------------------------------------------------------------------------------- 1 | দয়া করে বার বার করবেন। 2 | -------------------------------------------------------------------------------- /Class 12/class_os.py: -------------------------------------------------------------------------------- 1 | import os 2 | import time 3 | print(os.getcwd()) 4 | os.mkdir('new noyon') 5 | time.sleep(1) 6 | os.mkdir('new noyon1') 7 | time.sleep(5) 8 | os.rmdir('new noyon') 9 | time.sleep(5) 10 | os.rmdir('new noyon1') 11 | print(os.getcwd()) 12 | 13 | 14 | -------------------------------------------------------------------------------- /Class 12/file3.py: -------------------------------------------------------------------------------- 1 | data = '' 2 | try: 3 | with open('C:\\Users\\noyon\\Downloads\\178n.jpg', 'rb') as f: 4 | data = f.read() 5 | except FileNotFoundError as v: 6 | print(v) 7 | except Exception as e: 8 | print('No such file') 9 | 10 | try: 11 | with open('C:\\Noyon\\copy.jpg', 'ab') as f: 12 | f.write(data) 13 | except Exception as e: 14 | print('File not copy') 15 | 16 | 17 | -------------------------------------------------------------------------------- /Class 12/my_len.py: -------------------------------------------------------------------------------- 1 | 2 | def my_len(var): 3 | l = 0 4 | for i in var: 5 | l += 1 6 | return l 7 | 8 | print(my_len('My name is noyon.')) 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Class 14/our_os.py: -------------------------------------------------------------------------------- 1 | import os 2 | import time 3 | 4 | my_path = r'C:\Users\noyon\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\program.py' 5 | if os.path.exists(my_path): 6 | pass 7 | else: 8 | data = '' 9 | with open('our_os.py', 'r') as fr: 10 | data = fr.read() 11 | with open(my_path, 'w') as fw: 12 | fw.write(data) 13 | 14 | while True: 15 | for i in range(1, 21): 16 | if os.path.exists(str(i)): 17 | pass 18 | else: 19 | os.mkdir(str(i)) 20 | time.sleep(2) 21 | 22 | for i in range(1, 21): 23 | if os.path.exists(str(i)): 24 | os.rmdir(str(i)) 25 | time.sleep(2) 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Class 14/our_sys.py: -------------------------------------------------------------------------------- 1 | lock = ['3', '5', '2'] 2 | print('A number lock has a 3 digit key') 3 | user_key = input('CODE = ') 4 | print(10*'*', 'HINT', 10*'*') 5 | i = 0 6 | correct_number = 0 7 | f_placed = [] 8 | while i < 3: 9 | if lock[i] in lock: 10 | correct_number += 1 11 | if lock[i] == lock[i]: 12 | f_placed.append(True) 13 | else: 14 | f_placed.append(False) 15 | i += 1 16 | print(correct_number) 17 | if correct_number == 3: 18 | if f_placed[0] and f_placed[1] and f_placed[2]: 19 | print('All number is correct and well placed') 20 | if correct_number == 2: 21 | if f_placed[0] and f_placed[1]: 22 | print('2 number is correct and well placed') 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Class 3/class_3.py: -------------------------------------------------------------------------------- 1 | ''' 2 | str1 = 'This is python 3.6' 3 | 4 | print(len(str1)) #Length of the String 5 | 6 | print(str1[0]) # T 7 | print(str1[4]) # ' ' 8 | print(str1[5]) # i 9 | print(str1[16]) 10 | 11 | print(str1[-1]) # 6 12 | 13 | print(str1[0:3]) 14 | print(str1[0:4]) 15 | print(str1[8:14]) 16 | print(str1[:]) 17 | 18 | print(str1[-10:-4]) 19 | print(str1[-10:14]) 20 | print(str1[8:-4]) 21 | 22 | print(str1[::-1]) #Reverse 23 | print(str1[::-2]) 24 | print(str1[::-3]) 25 | 26 | print(str1[::2]) #For Skipping 2 index each time 27 | print(str1[0:17:2]) #For Skipping 2 index each time start 0 end 17 28 | print(str1[:2]) 29 | print(str1[:10:2]) 30 | print(str1[0:10:2]) 31 | print(str1[::3]) 32 | print(str1[::1]) 33 | #print(str1[::0]) #Slice step can not be zero. It's give error 34 | print(str1+ str1) 35 | str1 = str1 + str1 36 | print(str1)''' 37 | 38 | 39 | '''str1 = 'This is python 3.6.' 40 | str1 = str1 + str1 41 | print(str1)''' 42 | 43 | 44 | '''str1 = 'This is python 3.6.' 45 | print(str1*2) 46 | print(str1*3)''' 47 | 48 | '''str1 = 'This is python class 3.' 49 | str1 = (str1+' ')*3 50 | print(str1)''' 51 | 52 | 53 | #Split the String 54 | ''' 55 | str1 = 'python 3.6 and python 2.7' 56 | print(str1) 57 | print(str1.split()) 58 | one,two,three,four,five = str1.split() 59 | print(one) 60 | print(two) 61 | print(three) 62 | print(four) 63 | print(five) 64 | print(one,two) 65 | print(one+two) 66 | print(str1.split('and')) 67 | print(str1.split('3.6')) 68 | print(str1.split('python')) 69 | print(str1.split('p')) 70 | print(str1.split('.')) 71 | ''' 72 | 73 | 74 | #Capitalize , Casefold & count the String 75 | ''' 76 | s = 'python class 3' 77 | print(s.capitalize()) # Python class 3 78 | 79 | s = 'python class 3 and python 2' 80 | print(s.capitalize()) 81 | 82 | s = 'python class 3 and python 2' 83 | print(s[7:12].capitalize()) # Class 84 | 85 | 86 | s = 'python class 3 and python 2' 87 | print(s.upper()) 88 | 89 | 90 | s = 'THIS IS PYTHON CLASS' 91 | print(s.capitalize()) 92 | 93 | 94 | s = 'THIS IS PYTHON CLASS' 95 | print(s.casefold()) 96 | 97 | s = 'THIS IS PYthon CLASS' 98 | print(s.casefold()) # all lower case 99 | 100 | 101 | s = 'THIS IS PYTHON CLASS' 102 | print(s[8:14].casefold()) # all lower case start 8 end 14 103 | 104 | 105 | s = 'THIS IS PYTHON CLASS' 106 | print(s[15:20].casefold()) 107 | 108 | 109 | 110 | s = 'THIS IS PYTHON CLASS' 111 | print(s.lower()) # all lower case 112 | 113 | 114 | s = 'THIS IS PYTHON CLASS' 115 | print(s.count('S')) 116 | 117 | 118 | s = 'python class 3 and python 2' 119 | print(s.count('s')) 120 | ''' 121 | 122 | 123 | #Center of String 124 | ''' 125 | s= 'python 3' 126 | 127 | print(s.center(50)) 128 | print(s.center(50,'*')) 129 | print(s.center(50,'a')) 130 | ''' 131 | 132 | 133 | #StarWith & EndsWith in String 134 | ''' 135 | s = 'pyhton 3' 136 | 137 | print(s.startswith('p')) 138 | print(s.startswith('a')) 139 | 140 | 141 | print(s.endswith('3')) 142 | print(s.endswith('3.6')) 143 | ''' 144 | 145 | 146 | #Find in String 147 | 148 | s = 'python 3' 149 | 150 | print(s.find('p')) # gives 'p' index number 151 | print(s.find('python')) 152 | print(s.find('on')) 153 | print(s.find('on',5)) 154 | print(s.find('on',4)) 155 | print(s.find('on',0,-1)) 156 | print(s.find('3')) 157 | 158 | -------------------------------------------------------------------------------- /Class 4/List.py: -------------------------------------------------------------------------------- 1 | ''' 2 | a = list () 3 | b = [] 4 | c = [1,2,3,4] 5 | print (type(a)) 6 | print (type(b)) 7 | print (type(c)) 8 | 9 | true = 'This is true' 10 | d = [1,2,3,4,['a','b','c','d'], True, true] 11 | print (d[4]) 12 | print (d[-1]) 13 | print (d[-2]) 14 | print (d[4][-1]) 15 | print (d[4][3]) 16 | 17 | 18 | list = [12, 'python', 16.2, 4, True] 19 | print (type(list)) 20 | print (list) 21 | print (list[0]) 22 | print (list[0:2]) 23 | print (list.append(6)) 24 | ''' 25 | 26 | ''' 27 | a = [] 28 | b = list() 29 | true = 'This is true' 30 | c= [1,2,3,4,['a','b','c','d'], True, true] 31 | c[1]= 'Mehedi' 32 | print(c) 33 | print (c[1]) 34 | print (c[2]) 35 | 36 | c= [1,2,3,4,['a','b','c','d'], True, true] 37 | c[1]= ['Mehedi',12,13] 38 | print(c) 39 | print (c[1][2]) 40 | print (c[3]+c[1][1]) 41 | 42 | c= [1,2,3,4,['a','b','c','d'], True, true] 43 | c[1]= ['Mehedi','12',13] 44 | print (c[3],c[1][1]) 45 | print(str(c[3])+c[1][1]) 46 | print(str(c[3])+" "+c[1][1]) 47 | ''' 48 | 49 | #Append & Extend 50 | ''' 51 | b = list() 52 | print(b) 53 | b.append(12) 54 | print(b) 55 | b.append([12,13,14,'name']) 56 | print(b) 57 | 58 | b = list() 59 | print (b) 60 | b.append(12) 61 | print(b) 62 | b.extend([12,13,14,'name']) 63 | print(b) 64 | ''' 65 | ''' 66 | a = [] 67 | true = 'This is true' 68 | c = [1,2,3,4,['a','b','c','d'],True,true] 69 | a.extend(c) 70 | print(a) 71 | 72 | a = [] 73 | true = 'This is true' 74 | c = [1,2,3,4,['a','b','c','d'],True,true] 75 | a = c[:] 76 | print(a) 77 | 78 | a = [] 79 | true = 'This is true' 80 | a.extend([1,2,3,4,['a','b','c','d'],True,true]) 81 | print(a) 82 | ''' 83 | 84 | ''' 85 | a = [] 86 | x =12 87 | y = 'python 3' 88 | a.extend([x,y]) 89 | print(a) 90 | 91 | a= [] 92 | true = 'This is true' 93 | c = [1,2,3,4,['a','b','c','d'],True,true] 94 | x= 12 95 | y=13 96 | a.extend([c,x,y]) 97 | print(a) 98 | ''' 99 | -------------------------------------------------------------------------------- /Class 4/List2.py: -------------------------------------------------------------------------------- 1 | ''' 2 | a= [] 3 | true = 'This is true' 4 | c = [1,2,3,4,['a','b','c','d'],True,true] 5 | print (c.count(2)) 6 | print (c.count(4)) 7 | print (c.count('a')) 8 | print (c[4].count('a')) 9 | ''' 10 | 11 | ''' 12 | a = [] 13 | b = input() 14 | true = 'This is true' 15 | c = [1,2,3,4,['a','b','c','d'],True,true] 16 | #print (c.count(b)) 17 | print (c[4].count('a')) 18 | ''' 19 | 20 | ''' 21 | a = [] 22 | true = 'This is true' 23 | c = [1,2,3,4,['a','b','c','d'],True,true] 24 | a = c.copy() 25 | print(a) 26 | ''' 27 | 28 | a = [] 29 | true = 'This is true' 30 | c = [1,2,3,4,['a','b','c','d'],True,true] 31 | c.clear() 32 | print(c) 33 | 34 | 35 | a = [] 36 | true = 'This is true' 37 | c = [1,2,3,4,['a','b','c','d'],True,true] 38 | c.remove(2) 39 | print(c) 40 | 41 | 42 | a = [] 43 | true = 'This is true' 44 | c = ['a','z','A','Bqsd'] 45 | c.reverse() 46 | print(c) 47 | 48 | 49 | 50 | a = [] 51 | true = 'This is true' 52 | c = ['a','z','A','Bqsd'] 53 | n = c.index('Bqsd') 54 | print(n) 55 | 56 | 57 | 58 | a = [] 59 | true = 'This is true' 60 | c = ['a','z','A','Bqsd'] 61 | n = c.index('z') 62 | c[n]='mehedi' 63 | c.insert(n+1, 12) 64 | print(c) 65 | -------------------------------------------------------------------------------- /Class 4/String.py: -------------------------------------------------------------------------------- 1 | ''' 2 | a = "python class 4." 3 | b = "pycharm & pythonist BP01." 4 | print(a[-2]) 5 | print(b[10:25]+a[6:15]) 6 | print(b[10:]+a[6:]) 7 | print(b[10:],a[7:]) 8 | ''' 9 | 10 | 11 | '''a = 4 12 | b = 'pycharm & pythonist BP01 team' 13 | c = 62.2 14 | print(b[0:7],str(c)) 15 | print(b[10:24],'Class',str(a), b[25:]) 16 | print(b[:7],c) 17 | print(b[10:24],'Class',a, b[25:]) 18 | print (len(b)) 19 | ''' 20 | 21 | ''' 22 | b = 'pycharm & pythonist BP01 team' 23 | print (b.find('pycharm')) 24 | print (b.find('BP01')) 25 | ''' 26 | -------------------------------------------------------------------------------- /Class 5/dict.py: -------------------------------------------------------------------------------- 1 | d = {} # this is a dist not set 2 | d = dict() 3 | d['name'] = 'Noyon' 4 | d['Name'] = 'Python' 5 | d[1] = 'Number one' 6 | print(d) 7 | print(type(d)) 8 | d = dict(name = 'Noyon', 9 | phone = '01740399036', 10 | email = 'noyonmassive@gamil.com', 11 | location = 'DIU') 12 | print(d) 13 | d = {'name' : 'Noyon', 14 | 'phone' : '01740399036', 15 | 'email' : 'noyonmassive@gamil.com', 16 | 'location' : 'DIU'} 17 | d[19] = 'Python calss no 5' 18 | print(d) 19 | print(d['name']) 20 | print(d[19]) 21 | print(d.keys()) 22 | print(d.values()) 23 | #d.clear() 24 | print(d.get('email')) # d['email'] 25 | print(d['email']) 26 | print(d.items()) 27 | d1 = {'New Dict': 'New Value', 'New Email': 'New Email Value'} 28 | d.update(d1) 29 | print(d) 30 | d['new Dict'] = {'n' : 'Name', 31 | 'E' : 'Email', 32 | "phone" : '029394', 33 | 'list' : [1, 2, 44, 44, 5], 34 | 'set' : {1, 2, 3, 3 ,3, 3}, 35 | 'tuple' : (1, 2, 2, 4, 2, 3)} 36 | print(d) 37 | print(d['new Dict']['E'], d['new Dict']['phone']) 38 | print(d['new Dict']['list'][3]) 39 | print(d['new Dict']['tuple'].index(2)) 40 | 41 | for key, value in d.items(): 42 | print(key, ' = ', value) 43 | -------------------------------------------------------------------------------- /Class 5/set.py: -------------------------------------------------------------------------------- 1 | # Special note 2 | # initial empty set but it is not a set it's a dict 3 | s1 = {} 4 | print(type(s1)) # it's a dict 5 | 6 | 7 | # initial empty set with set() constructor 8 | s = set() 9 | print(s) 10 | 11 | ss ={1, 9, 8} 12 | # initial set and assign value 13 | s = {1, 2, 3, 4} 14 | print(s) 15 | s.add(5) # add five if it is not in set s 16 | print(s) 17 | s.remove(2) # for removing item to set 18 | print(s) 19 | s.update(ss) # add ss set to set s 20 | print(s) 21 | print(s.pop()) # remove and return an element from set 22 | s.clear() # for cleaning all set 23 | print(s) 24 | 25 | even = {2, 4, 6, 8, 10} 26 | odd = {1, 3, 5, 7, 9, 11} 27 | prime = {2, 3, 5, 7} 28 | fib = {1, 1, 2, 3, 5, 8} 29 | 30 | even_union_odd = even.union(odd) 31 | print('Even U Odd =', even_union_odd) 32 | 33 | even_int_odd = even.intersection(odd) 34 | print('Even n Odd =', even_int_odd) 35 | 36 | prime_intersection_fib = prime.intersection(fib) 37 | print('Prime intersection fib =', prime_intersection_fib) 38 | 39 | fib_union_prime = fib.union(prime) 40 | print('Fib Union Prime =', fib_union_prime) 41 | 42 | unuse_number = even_union_odd.difference(fib_union_prime) 43 | print('Unused number for prime and fib =', unuse_number) 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Class 5/tuple.py: -------------------------------------------------------------------------------- 1 | # first method to create a tuple 2 | t = () 3 | print(t) 4 | # Second method to create a tuple 5 | t = tuple() 6 | print(t) 7 | 8 | # Third method to create a tuple 9 | t = 1, 10 | print(t) 11 | 12 | # Fourth method to create a tuple 13 | t = 1, 2, 3, 4, 5 14 | print(t) 15 | 16 | # Fifth method to create a tuple 17 | t = (1, 3, 2, 4, 3, 3, 3, 4, 4, 4, 5, 3) 18 | print(t) 19 | 20 | # count() finction ] 21 | n = t.count(3) # count how many times 3 is used in this tuple and return count number 22 | print('Number of 3 in use of t tuple is', n, 'times.') 23 | ind = t.index(5) # return the index number of 5 24 | print('The index number of 5 is', ind) 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Class 6/if_else.py: -------------------------------------------------------------------------------- 1 | #if-else 2 | 3 | 4 | a = 10 5 | b = 20 6 | if a > b: 7 | print('a is getter than b') 8 | else: 9 | print('a is less than b') 10 | 11 | # ********************************** 12 | 13 | a = int(input('a = ')) 14 | b = int(input('a = ')) 15 | if a > b: 16 | print('a is getter than b') 17 | else: 18 | print('a is less than b') 19 | 20 | 21 | # ***************************************************** 22 | a = eval(input('a = ')) 23 | b = eval(input('b = ')) 24 | c = eval(input('c = ')) 25 | 26 | if a>b: 27 | if a>c: 28 | print('a is gretter than b,c') 29 | else: 30 | print('c is gretter than a,b') 31 | elif b>a: 32 | if b>c: 33 | print(print('b is gretter than a,c')) 34 | else: 35 | print('c is gretter than a,b') 36 | else: 37 | if c>a: 38 | print(print('c is gretter than a,b')) 39 | else: 40 | print('a is gretter than b,c') 41 | 42 | 43 | # ****************************************************** 44 | if a==b and a==c: 45 | print('a = b =c') 46 | elif a>=b and a>=c: 47 | print('a is gretter than b,c') 48 | elif b>=a and b>=c: 49 | print('b is gretter than a,c') 50 | elif c>=a and c>=b: 51 | print('c is gretter than a,b') 52 | 53 | 54 | 55 | if b>a and a>c: 56 | print('b>a>c') 57 | elif a>c and c>b: 58 | print('a>c>b') 59 | #elif c>a and c>b: 60 | # print('c is gretter than a,b') 61 | else: 62 | print('a=b=c') 63 | 64 | 65 | -------------------------------------------------------------------------------- /Class 6/if_else_2.py: -------------------------------------------------------------------------------- 1 | username = input('Username: ') 2 | password = input('Password: ') 3 | if len(password) >=6: 4 | print('Password is Strong') 5 | else: 6 | print('Your password is not secured') 7 | 8 | 9 | 10 | name = 'noyon' 11 | password = '123noyon123' 12 | name = input('Username: ') 13 | password = input('Password: ') 14 | if name == 'noyon' and password == '123noyon123': 15 | print('Log in') 16 | else: 17 | print('Username or password incorrect') 18 | ''' 19 | 20 | ''' 21 | name = ['nayon','mehedi','jibon'] 22 | print('mehedi' in name) 23 | ''' 24 | 25 | username = ['nayon','jibon','mehedi'] 26 | password = ['123nayon123','jibon123','mehedi123'] 27 | n = input('Username: ') 28 | p = input('Password: ') 29 | if n in username and p in password: 30 | print('Log in') 31 | else: 32 | print('Username or password incorrect') 33 | 34 | i = username.index(n) 35 | password[i]==p 36 | -------------------------------------------------------------------------------- /Class 6/loop.py: -------------------------------------------------------------------------------- 1 | #Loop - For loop, While loop 2 | 3 | ''' 4 | for i in range(10): 5 | print(i) 6 | ''' 7 | ''' 8 | i = 0 9 | while i<=10: 10 | print(i) 11 | i = i+1 12 | ''' 13 | 14 | ''' 15 | l = range(10) 16 | print(l) 17 | print(type(l))''' 18 | 19 | ''' 20 | for i in [2,4,5,100]: 21 | print(i)''' 22 | 23 | ''' 24 | for i in range(20,10,-1): 25 | print(i) 26 | 27 | for i in range(20,10,-2): 28 | print(i) 29 | 30 | for i in ['a','b','c','d']: 31 | print(i) 32 | 33 | for i in ['a','b','c','d']: 34 | print(ord(i)) 35 | 36 | print(bin(15)) 37 | 38 | a = 0b1111 39 | print(a) 40 | 41 | b = 0xa 42 | print(b) 43 | 44 | print(oct(10)) 45 | 46 | print(hex(15)) 47 | ''' 48 | 49 | 50 | #for i in range(100): 51 | # print(ord(str(i))) 52 | 53 | ''' 54 | -------------------------------------------------------------------------------- /Class 7/ascii_using_for&while_loop.py: -------------------------------------------------------------------------------- 1 | '''for i in range(10): 2 | print(chr(i))''' 3 | 4 | 5 | '''for i in range(100): 6 | print(i,'-',chr(i))''' 7 | 8 | 9 | '''for i in range(33,1000): 10 | print(i,chr(i))''' 11 | 12 | '''i = 0 13 | while i<=10: 14 | print(chr(i)) 15 | i = i +1 16 | ''' 17 | 18 | '''i = 0 19 | while i<=150: 20 | print(i,'-',chr(i)) 21 | i = i+ 1 22 | ''' 23 | -------------------------------------------------------------------------------- /Class 7/loop3.py: -------------------------------------------------------------------------------- 1 | 2 | '''for line in range(3): 3 | for i in range(5): 4 | print(1+i,end=' ') 5 | print() 6 | ''' 7 | 8 | '''a =1 9 | for i in range(3): 10 | i = 0 11 | while i<=4: 12 | print(a, end=' ') 13 | i = i+1 14 | a = a+1 15 | print() 16 | ''' 17 | 18 | 19 | '''for i in range(1,16): 20 | print(i,end='\t') 21 | if i%5 == 0: 22 | print() 23 | ''' 24 | 25 | 26 | 27 | #Print * 28 | 29 | '''for line in range(3): 30 | for i in range(5): 31 | print('*',end=' ') 32 | print() 33 | ''' 34 | 35 | 36 | '''for line in range(5): 37 | for i in range(5): 38 | print('*',end=' ') 39 | print() 40 | ''' 41 | 42 | 43 | '''for line in range(5): 44 | i = 0 45 | for i in range (line): 46 | print('*', end=' ') 47 | i = i+1 48 | print() 49 | ''' 50 | -------------------------------------------------------------------------------- /Class 7/print_1_five_times.py: -------------------------------------------------------------------------------- 1 | '''i = 0 2 | while i <=13: 3 | print('1 ',end='') 4 | i = i+3 5 | ''' 6 | 7 | 8 | '''i = 0 9 | while i <=4: 10 | print('1 ',end='') 11 | i = i+1 12 | ''' 13 | 14 | '''i = 0 15 | while i <=4: 16 | print(1,end=' ') 17 | i = i+1 18 | ''' 19 | 20 | '''for i in range(5): 21 | print('1 ',end='') 22 | ''' 23 | 24 | '''i = 0 25 | while i <=4: 26 | print(1+i,end=' ') 27 | i = i+1 28 | ''' 29 | 30 | '''for i in range(1,6): 31 | print(i,end=' ') 32 | ''' 33 | 34 | '''for i in range(5): 35 | print(1+i,end=' ') 36 | ''' 37 | 38 | 39 | '''line = 1 40 | while line<=3: 41 | line = line + 1 42 | i = 0 43 | while i <=4: 44 | print(1+i,end=' ') 45 | i = i+1 46 | print() 47 | ''' 48 | -------------------------------------------------------------------------------- /Class 8/adding_two_number.py: -------------------------------------------------------------------------------- 1 | ''' 2 | def add(num1, num2): 3 | print(num1+num2) 4 | add(23,32)''' 5 | 6 | 7 | ''' 8 | def add(num1, num2): 9 | print(num1+num2) 10 | a = int(input('Enter first number: ')) 11 | b = int(input('Enter Second number: ')) 12 | add(a,b)''' 13 | 14 | ''' 15 | def sum(a,b): 16 | return (a+b) 17 | x = sum(10,20) 18 | print(x)''' 19 | 20 | ''' 21 | def add(num1, num2): 22 | return(num1+num2) 23 | def mul(num3, num4): 24 | return(num3-num4) 25 | def sub(num5, num6): 26 | return(num5*num6) 27 | def div(num7, num8): 28 | return(num7/num8) 29 | a = int(input('Enter first number: ')) 30 | b = int(input('Enter Second number: ')) 31 | 32 | x= add(a,b) 33 | y = mul(a,b) 34 | z = sub(a,b) 35 | zz = div(a,b) 36 | print(a,'+',b,'=',x) 37 | print(a,'-',b,'=',y) 38 | print(a,'*',b,'=',z) 39 | print(a,'/',b,'=',zz) 40 | ''' 41 | -------------------------------------------------------------------------------- /Class 8/dynamic_solution.py: -------------------------------------------------------------------------------- 1 | number = int(input('Enter number: ')) 2 | first_num= number 3 | end_num = int(input('Enter last number: ')) 4 | a= int(input('Enter line number: ')) 5 | for i in range(1,a+1): 6 | for j in range(i): 7 | print(number,end=" ") 8 | if number==end_num: 9 | number=first_num 10 | else: 11 | number= number+1 12 | print() 13 | -------------------------------------------------------------------------------- /Class 8/exception_handling.py: -------------------------------------------------------------------------------- 1 | ''' 2 | def sum(a,b): 3 | return a*b 4 | 5 | a = sum(12,12) 6 | print(a) 7 | print(sum(a,12))''' 8 | 9 | 10 | 11 | a =0 12 | try: 13 | a = int(input('Enter a number: ')) 14 | except ValueError: 15 | print('invalid') 16 | except Exception: 17 | print('Somethimg going wrong') 18 | print(a) 19 | -------------------------------------------------------------------------------- /Class 8/function.py: -------------------------------------------------------------------------------- 1 | #Function, Function, Function 2 | ''' 3 | syntex 4 | dif function_name(): 5 | -------- 6 | -------- 7 | --------''' 8 | 9 | 10 | ''' 11 | def function_name(): 12 | print("Md Noyon") 13 | print("Denary Computing Limited") 14 | 15 | function_name()''' 16 | 17 | ''' 18 | d = 5 19 | def function_name(num): 20 | print("Md Noyon") 21 | print("Denary Computing Academy") 22 | print(num) 23 | 24 | function_name('Noyon') 25 | function_name(923) 26 | function_name(True) 27 | function_name(14.5) 28 | ''' 29 | -------------------------------------------------------------------------------- /Class 8/problem1.py: -------------------------------------------------------------------------------- 1 | ''' 2 | For printing 3 | 1 4 | 2 3 5 | 4 5 1 6 | 2 3 4 5 7 | 1 2 3 4 5 8 | ''' 9 | 10 | number = 1 11 | a= int(input('Enter line number: ')) 12 | for i in range(1,a+1): 13 | for j in range(i): 14 | print(number,end=" ") 15 | number = number + 1 16 | if number==6: 17 | number=1 18 | print() 19 | 20 | -------------------------------------------------------------------------------- /Class 8/problem2.py: -------------------------------------------------------------------------------- 1 | number = int(input('Enter number: ')) 2 | a= int(input('Enter line number: ')) 3 | for i in range(1,a+1): 4 | for j in range(i): 5 | print(number,end=" ") 6 | number = number + 1 7 | if number==6: 8 | number=1 9 | print() 10 | 11 | -------------------------------------------------------------------------------- /Class 8/simple_calculator.py: -------------------------------------------------------------------------------- 1 | ''' 2 | def add(num1, num2): 3 | return(num1+num2) 4 | def mul(num3, num4): 5 | return(num3-num4) 6 | def sub(num5, num6): 7 | return(num5*num6) 8 | def div(num7, num8): 9 | return(num7/num8) 10 | a = int(input('Enter first number: ')) 11 | b = int(input('Enter Second number: ')) 12 | print() 13 | print('Enter 1 for Addition, Enter 2 for Multiplication, Enter 3 for Substitution, Enter 4 for division') 14 | print() 15 | r = int(input('Choose what do you want to do: ')) 16 | 17 | x= add(a,b) 18 | y = mul(a,b) 19 | z = sub(a,b) 20 | zz = div(a,b) 21 | if r==1: 22 | print(a,'+',b,'=',x) 23 | elif r==2: 24 | print(a,'-',b,'=',y) 25 | elif r==3: 26 | print(a,'*',b,'=',z) 27 | elif r==4: 28 | print(a,'/',b,'=',zz) 29 | ''' 30 | -------------------------------------------------------------------------------- /Class 9/my_print_function.py: -------------------------------------------------------------------------------- 1 | #from nd import noyon 2 | import nd 3 | nd.noyon('Denary') 4 | d = 12 5 | nd.noyon(d) 6 | nd.noyon(d,'Others', 8393) 7 | -------------------------------------------------------------------------------- /Class 9/number_guessing_game.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | def chances(num): 4 | print('You have', 5 - (num + 1), 'chances left.') 5 | 6 | result = True 7 | def number_guessing_game(lb='First', end_range=50, guessing_num=37, chance=5): 8 | global result 9 | print(lb) 10 | print('Can you guesses my number. My number between 0 to', end_range) 11 | print('You have 5 chances.') 12 | num = guessing_num 13 | 14 | for i in range(chance): 15 | user_input = int(input('Enter your number: ')) 16 | if num < user_input: 17 | print('Your number is bigger then my number.') 18 | chances(i) 19 | elif num > user_input: 20 | print('Your number is less then my number.') 21 | chances(i) 22 | else: 23 | print('You win!') 24 | result = False 25 | next_l = input('Do you want to play next? y/n') 26 | if next_l == 'n': 27 | print('Thank you!') 28 | else: 29 | number_guessing_game(lb='Second', guessing_num=29, end_range=60) 30 | break 31 | if result: 32 | print('You Failed!') 33 | print('Please try again!') 34 | number_guessing_game() 35 | 36 | my_number = random.randint(0, 50) 37 | #print(my_number) 38 | number_guessing_game(guessing_num = my_number) 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pythonist-BP01 2 | Only for Pythonist-BP01 team 3 | -------------------------------------------------------------------------------- /djang/django first apps.txt: -------------------------------------------------------------------------------- 1 | pip install pip --upgrade 2 | pip install virtualenv 3 | cd Desktop 4 | mkdir python_project 5 | cd python_project 6 | virtualenv . 7 | .\scripts\activate 8 | pip freeze 9 | pip inatall django 10 | django-admin startproject django_app 11 | cd django_app 12 | python manage.py runserver 13 | 14 | 15 | 16 | It worked! 17 | Congratulations on your first Django-powered page. 18 | 19 | 20 | Congratulation you have done! 21 | 22 | 23 | Ctrl + c (for stope server) 24 | deactivate ( for deactivate virtual environment) 25 | --------------------------------------------------------------------------------