Temperature conversion

This is a python program to convert temperature from Celsius  to Fahrenheit . print(“Temperature conversion”) print(“1.celcius to fehrenheit”, “2.fehrenheit to celcius”) choice=int(input(“Enter your choice”)) if choice==1: c=int(input(“Enter temperature in celcius”)) f=(9*c)/5+32 print(f”temperature in fehrenheit is {f}”) else: f = int(input(“Enter temperature in fehrenheit”)) c = ((f-32)*5)/9 print(f”temperature in celcius is {f}”)  

Distance conversion

This is a python program to convert distance from kilometers to miles. print(” Distance conversion”) print(“1.kilometer to miles”, “2.miles to kilometer”) choice=int(input(“Enter your choice”)) if choice==1: d1=int(input(“Enter distance in kilometer”)) d2=d1*0.621371 print(f”Distance in miles is {d2}”) else: d1 = int(input(“Enter distance in miles”)) d2=d1/0.621371 print(f”Distance in kilometer is {d2}”)  

Random number

Random number is generated using a python built-in module i. e. random.random function of random module generate a random floating point number and rand-int  function generate a random number between the given interval. import random print(“Enter two numbers between them we wants to genrate a number:”) num1=int(input()) num2=int(input()) rnum=random.randint(num1,num2) print(rnum)  

Python Program to Swap Two Number – Without Using Third Variable

This is python program to swap two numbers given by user as input  – a=input(“enter first number”) b=input(“enter second number”) print(f”numbers before swapping: a={a},b={b}”) a,b=b,a print(f”numbers after swapping: a={a},b={b}”) Tags: python basic programs, python swap two, top python,

Arithmatic operation

print(“Enter two numbers to perform arithmatic operation:”) num1=int(input()) num2=int(input()) print(“Addition of the given numbers is “,num1+num2) print(“Subtraction of the given numbers is “,num1-num2) print(“Multiplication of the given numbers is “,num1*num2) print(“Division of the given numbers is “,num1/num2) print(“Floor division of the given numbers is “,num1//num2) print(“Modulus of the given numbers is “,num1%num2) print(“Power of the … Read more

Reverse Digits of an integer – Python Program – One of Most Common Interview Question

Python program to reverse a number, reverse digits of a number, reverse integer, python programs, python programs to reverse a number, basic python programs. Reverse Digits of an integer –  One of Most Common Interview Question Problem  – Write a Python program to reverse digits of an integer. Example 1 : Input : 123, Output … Read more

Python Object Oriented Programming

PYTHON : OOPs Python is a multi-paradigm programming language. It means that Python supports different programming approach. Python Object Oriented Programming approach (OOPs) is the  easiest and the most popular one among them . Introduction to OOPs Object Oriented Programming is referred as a programming approach , where the programs are organised as objects. This … Read more

%d bloggers like this: