Skip to main content

Posts

Showing posts from November, 2020

I built a Django weather app using openweatherapp API

 I built a Django weather app using openweatherapp API.  Yes i built this simple weather app using openweatherapp API, it was fun an easy to built with django. How do i built it? I install the module needed for this project, the only module we need is a request module for python since i am using python to built this project. After installing and setting up the project with django i download a template and start with creating the views for the project. Here how goes: 1.First go to openweather app website : https://openweathermap.org/ 2.Signup for an account so that the openweather app will send you an api key 3.After singup with an account go to API and select the API you want to use 4.In an API doc it will attach a link which look like this api.openweathermap.org/data/2.5/weather?q= {city name} &appid= {API key} So we need to replace the {API key} with our own API key. 5.That it for the API so in order to make a request or to call the API in python we use a request module to call

I built a heathcare website from scratch with html,css,javascript and python(Django) framework.

I built a heathcare website from scratch with html,css,javascript and python(Django) framework.  Healthcare Website Here how it goes from the beginning of the process of making the website. Back then in the month of Jan i learn complete in depth about HTML and CSS an a little bit of java script by designing a website everyday until i feel a bit confident about my front end part i design a website every single day for the whole month of Jan. By the end of Jan i am a little bit busy with my academics and then lock down started so i told my self what can i do with python language because i was quite comfortable with python but at that time i'm not interest into machine learning or AI, I was more into web development so i told myself how can i use my python skill into real world, so i did some research and i found out that Django is the web framework of python they also suggest that for a beginner to use flask because Django is quite confusing but i just pick Django with out thinking a

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  customi

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:         return "Not a prime"      #If the number has exactly 2 factor then we return as a prime number     if count==2:         return "Prime"     else:         return "Not a prime" #Taking user input n = int(input()) #calling the prime number function print(prime(n)) Input: 2 Output: Prime Input: 1 Output: Not

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)         temp//=10     #Print the result     print("Armstrong") if sum==n else print("Not armstrong") n = int(input()) #calling the armstrong function armstrong(n)   Input: 153 Output: Armstrong Input: 345 Output: Not armstro

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 first digit         rem = rem*10+dig         n = n//10      #check if the reverse of a string is equal to the original string     print("Palindrome") if temp == rem else print("Not a palind