Rajesh SinghJun 20, 20211 minPython program to add one or more element in ListProgram: #Append() is used for adding one element in List at the end of list. X=[9,18,27] X.append(36) print(X) output: [9, 18, 27, 36]...
Rajesh SinghJun 18, 20211 minPython program to remove elements of a given listProgram: n=[9,18,27,36,45,54,63] print("List=",n) i=int(input("Enter the position of elements to delete : ")) del n[i] print("List after...
Rajesh SinghJun 16, 20211 minPython program to find minimum value in ListProgram: list=[(1,15,11), (4,7,1), (7,11,2),(10,10,18)] print("The list is: " +str(list)) res1=min(list)[0] res2=min(list)[1]...
Rajesh SinghJun 16, 20211 minPython program to find maximum value in ListProgram: list=[(1,15,11), (4,7,1), (7,11,2),(10,10,18)] print("The list is: " +str(list)) res1=max(list)[0] res2=max(list)[1]...
Rajesh SinghJun 16, 20211 minPython program convert kilometers to milesProgram: n=float(input("Enter value in kilometers: ")) a=n*.621371 print("The miles of given kilometers is %.2f" %a) Output: Enter value...
Rajesh SinghJun 16, 20211 minPython program to find square root of given numberProgram: n=float(input("Enter a number: ")) a=n**.5 print("The square roots of given number is ", a) Output: Enter a number: 16 The...
Rajesh SinghMay 23, 20211 minPython program to print series 1,4,9......15 termsProgram: for i in range(1,16): j=i*i print(j) Output: 1 4 9 16 25 36..................225 Python program to print series 1,4,9......15...
Rajesh SinghMay 23, 20211 minPython program to print 10 even numbers in reverse orderProgram: a=20 while a>=2: print(a) a=a-2 Output: 20 18 16 14 12 10 8 6 4 2 Python program to print 10 even numbers in reverse order Video:
Rajesh SinghMay 21, 20211 minPython program to input principle amount, rate of interest and time and find to Simple interest.Program: p=int(input("Enter the Principle Amount : ")) r=float(input("Enter the rate of interest : ")) t=int(input("Enter the Time Period...
Rajesh SinghMay 21, 20211 minPython program to input temperature in Celsius and convert it into Fahrenheit.Program: C=int(input("Enter the temperature in Celsius : ")) F=1.8*C+32 print("Temperature in Fahrenheit = ", F) Output: Enter the...
Rajesh SinghNov 11, 20201 minPython program to print sum of n natural numbersProgram: a=int(input("Enter a number: ")) sum = 0 while(a > 0): sum=sum+a a=a-1 print("The sum of natural numbers is",sum) Output: Enter...
Rajesh SinghApr 1, 20201 minWhile Loop in Python with exampleWhile loop is used to iterate over a block of code again and again until a given condition returns false. A program is executed...
Rajesh SinghApr 1, 20202 minFor Loop in Python with Examplefor () loop is a counting loop and repeats its body for a pre-defined number of times. It is a very versatile statement and has many...
Rajesh SinghApr 1, 20201 minNested If else statement in PythonIf statement is within another if statement then this is called nested of control statements. Example num = -100 if num > 0:...
Rajesh SinghApr 1, 20201 minIf elif else statement in python with examplesWe use the if..elif..else statement when we need to check multiple conditions. Syntax: if condition: statement1 elif condition_2:...
Rajesh SinghApr 1, 20201 minIf else Statement in Python with Examplesif statements is execute a certain block of Python code when a particular condition is true. Whenever If..else statements are execute...
Rajesh SinghMar 31, 20201 minPython Program to find roots of a Quadratic EquationThere are two method for finding roots of quadratic equation: Program: First Method: import cmath a = float (input("Enter the value of a...
Rajesh SinghMar 31, 20201 minPython Program to Check a Number is a Perfect NumberA perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. For instance, 6...
Rajesh SinghMar 31, 20201 minPython program to swap two numbersPython program Swap two Number with temporary variable a=int(input("Enter The First Number :")) b=int(input("Enter The Second Number :"))...
Rajesh SinghMar 29, 20201 minPython Program to Check number is Palindrome or NotA palindromic number is a number that remains the same when its digits are reversed. Like 121. Program: n=int(input("Enter number:")) a=n...