Display the terms of a Fibonacci series Python Program
Display the terms of a Fibonacci series Python Program # Program to display the Fibonacci sequence up to n-th term nterms = int(input("How many terms ? ")) # first two terms n1, n2 = 0, 1 count = 0 # check if the number of terms is valid if nterms…
Input a number and check if the number is a prime or composite number Python Program
Input a number and check if the number is a prime or composite number Python Program num = int(input("Enter any number : ")) if num > 1: for i in range(2, num): if (num % i) == 0: print(num, "is NOT a PRIME number, it is a COMPOSITE number")…
Determine whether a number is a perfect number an armstrong number or a palindrome Python Program
Determine whether a number is a perfect number an armstrong number or a palindrome Python Program # Palindrome (12321 is Palindrome) number=int(input("Enter any number:")) num=number num1= number rev=0 while num>0: digit=num%10 rev=rev*10+digit…
Python MySQL Connectivity Notes Class 12
Python MySQL Connectivity Notes Class 12 Interface Python with MySQL database Contents: ♦ Connecting SQL with Python ♦ Creating database connectivity application ♦ Performing insert, delete, update, queries ♦ Display data by using fetchone(),…
Random Function in Python MCQ Class 11-12
Random Function in Python MCQ Class 11-12 1. What does the following statement do? import random a) Imports the random module b) Imports a random module from a list of modules c) Imports the random function d) imports the directory named random…
Informatics Practices Sample Paper Term 2 Class 12
Informatics Practices Sample Paper Term 2 Class 12 Sample Question Paper INFORMATICS PRACTICES (Code : 065) Maximum Marks: 35 Time: 2 hours General Instructions The question paper is divided into 3 sections – A, B and C Section A, consists of…
Create a CSV file by entering user-id and password, read and search the password for given userid
Create a CSV file by entering user-id and password, read and search the password for given userid # Python Program import csv with open("user_info.csv", "w") as obj: fileobj = csv.writer(obj) fileobj.writerow(["User Id", "password"]) while(True):…
Input a list of numbers and swap elements at the even location with the elements at the odd location Python Program
Input a list of numbers and swap elements at the even location with the elements at the odd location Python Program # Program to input number list and swapping odd and even index elements # Entering 5 element Lsit mylist = [] print("Enter…
Input three numbers and display the largest/smallest number Python Program
Input three numbers and display the largest/smallest number Python Program # Python Program to input 3 numbers and display the largest number #input first,Second and third number num1=int(input("Enter First Number")) num2=int(input("Enter Second…
Input two numbers and display the larger/smaller number Python Program
Input two numbers and display the larger/smaller number Python Program # Python Program to input 2 numbers and display larger number #input first number num1=int(input("Enter First Number")) #input Second number num2=int(input("Enter…