Skip to main content

Posts

How to customize django admin?

 How to customize django admin with our own style? We all know django has it own default admin panel for a project  which look like this But we don't want our admin panel of our project to be name as django administration we want to customize it with our own style like changing the color, background color, text everything we want to change it as per our project UI So here you can do to change the django admin panel Step1: Go to the template folder Step2: Create a folder and name it as an admin so that it is easy for you to understand that this is the admin folder for our templates Step3:Inside an admin folder create a file name as 'base_site.html' in order to make you understand that this file is a file which overwrite the base file.Django has it default base HTML file so in order to customize the admin panel we have to overwrite the base file. Step4: run the server and go to to the admin panel and open developer tool by clicking inspect to see which one we want to  custo...

Python program to check prime number or not

  Given an integer,Write a python program to check if an integer is a prime number or not. Prime Number A given a number is said to be prime if the number has exactly two factor which is 1 and itself or the number is said to be prime  if the number is divided by 1 and itself. example -2 = factor of 2 is 1 and 2 so it is a prime because it has exactly two factor Example: 1. 2 -prime 2. 1 - Not a prime 3. 3 -Prime Python Program def prime(n):      #To count the factor of a number     count = 0      #we check from 2 because 1 is not a prime number     if n > 1:         for i in range(1,n+1):             if n%i==0:                 count+=1     else:         retur...

Python program to check whether the given number is an armstrong or not.

  Given an integer,Write a python program to check if an integer is an Armstrong or not. Armstrong A given a number is said to be armstrong if the number of order or length n is digit*n times and the sum is equal to the number given example - 153 = 1*1*1 + 5*5*5 +3*3*3 Example: 1. 153 - Armstrong 2. 345 - Not armstrong 3. 1634 - Armstrong Python Program #Check whether the given integer is an armstrong or not #function for armstrong def armstrong(n):     #convert into str to calculate the order of the digit     a = str(n)     temp,sum= n,0     while temp>0:         #modulo by 10 to get each and every digit of a number         digit = temp%10         #multiply each digit with the order of the digit and sum the values         sum+=digit**len(a) ...

Python program to check if a number or string a palindrome or not

Given a string or an integer,Write a python program to check if a string or an integer is a palindrome. Palindrome A given string or a number is said to be palindrome if the opposite or the reverse of the string or a number is same as the orginal string or number. Example: 1. 12321 - Palindrome 2. 345 - Not Palindrome 3. SOS - Palindrome 4. RUN - Not Palindrome Python Program #Function if the given input is a string def palinStr(n):      #check if the reverse of a string is equal to the original string     print('Palindrome') if n == n[::-1] else print('Not a palindrome') #Function if the given input is a number def palinInt(n):     rem = 0     temp = n     while n>0:          #Taking the last number         dig = n%10          #reverse the number from last digit to f...

Top 5 tips to grow as a programmer

 Hello, Welcome back to my blog today i am going to give you a 5 tips to grow as a programmer if you are a complete beginner. In this blog i am going straight to the point to make it short and interesting for you to read and please drop your suggestion by commenting or ping me in my instagram, i'm always welcome you. 5 tips to grow as a programmer 1.Learn the basic and jump straight to the project building: Here is the first tip i want to give you is to learn the basic or the fundamental of the language and jump straight to the project building because no matter how many time you learn the fundamental of the language you will never get it if you are not building a project. 2.Don't try to learn everything: It may sound strange but it is the reality of a programming world. Let take an example if you choose to learn a python don't try to learn everything about python, choose what do you want to do with python and learn what you need, because if you try to learn everything abou...

Build a tic tac toe game using python

 Hello, In this blog i am going to teach you how to create a tic tac toe game using python. If you know the basic of python like function, loops, conditional, list then you are good to go. In this project we are going to create it with a simple format of python without using any import or any object oriented programming. Requirement: 1.Board 2.Player(Computer and a user) 3.Winner Python fundamental needed: 1.Variable 2.List 3.If elif else 4.While 5.Function Here we are going to start A tic tac toe game is a game which has three rows and three column so we need a list which is the size of 3X3 which is nine to store the empty dash for the board Line 4: We assign a game_running to True which mean that the game is still runing when we first start the game. Line 6: Defining a function to display the board when ever we call the display_board function. Line 18: When we first start the game the board will display as empty with dash in it. Output is in line 8 Line 19:  We set the curre...

Best resource for learning python

Hi, I hope you are doing well, Today i am bringing you a brand new blog about the best resources for learning python. In this blog i divide the article into two section a book and a youtube video, Yes a youtube video, i learn python only from youtube video and from the book but for a book i spent some money to purchase them because i don't like reading book from the pdf. I will start off with youtube video 1. Corey Schafer Yes Corey Schafer is my all time favourite the explanation which he give is phenomenal, the python course is well structure and very well explained. 2. Programming with mosh Second one is a python course from programming with mosh , the course contain all the fundamental about python and he also give some introduction to different application of python like building web application with django a python framework and alot more. 3. Telusko Third one is Telusko, his course is also my favourite because he explain it in an easy way to understand. The above three is my...