Category Archives: Python Programming Language

Python Different Counts in String

Python Different Counts in String – Python program to count uppercase letters, lower case letters, vowels, consonants and spaces in the given string.   #Python program to count upper case letters, lower case letters #vowels, consonants and spaces in a string uppercase=0 lowercase=0 vowels=0 consonants=0 spaces=0 string=input(“Enter a String: “) for ch in string: if… Read More »

Loading

Python Program Check Positive Number

Python Program Check Positive Number – Write a Python program to input a number and check whether the given number is positive, negative or zero. Use Python if-elif-else construct. Python Program Check Positive, Negative or Zero Number # Python program to check a number # for positive, negative or zero num = int(input(‘Enter a number:… Read More »

Loading

Python Square Root Program

Python Square Root Program – Write a Python Program To find Square root of a number. Three Python programs to find square root of a number using Python. Code of Python Square Root Programs Program 1:Use Exponentiation Operator Exponentiation Operator ** in Python is used to raise the first operand/number to power of second number.… Read More »

Loading

Python GCD Recursive Function

Python GCD Recursive Function – Write a Python Program to find GCD of two numbers by recursion. Python GCD Recursive Function Python Program GCD of Two Numbers # Write a Python Program to find GCD # of two numbers using Recursion # define a recursive GCD function def recursive_gcd(a,b): if(b==0): return a else: return recursive_gcd(b,a%b)… Read More »

Loading

Python Power Recursive Function

Python Power Recursive Function – Write a Python program that uses recursion concept to calculate a number N raised to the power P.   Python Recursive Function Power # Write a Recursive Function power_recursive(n,p) # to calculate n raised to power p. # define function def power(n, p): if p == 0: return 1 else:… Read More »

Loading

Python Recursive Function Add Numbers

Python Recursive Function Add Numbers – Write a Python Program to display sum of 1 to 10 numbers using recursion. Call this recursive function in main. Python Code – Program With Recursive Function Add Numbers # Write a recursive function to add numbers # from 1 to 10 recursively. Call it from # main function… Read More »

Loading

Python Identifiers Naming Conventions

Today we shall discuss “Python Identifiers and Naming Conventions”. Python Identifiers A Python identifier is the name of a variable, function, class, module, or other object. We can say that Python Identifier is the name we use to identify a variable, function, class, module or other object in a Python program / script. We use… Read More »

Loading