Python Program to Print All Integers that Aren’t Divisible by Either 2 or 3

This is a Python Program to print all integers that aren’t divisible by either 2 or 3 and lies between 1 and 50. Problem Description The program prints all integers that aren’t divisible by either 2 or 3 and lies between 1 and 50. Problem Solution 1. Use a for-loop ranging from 0 to 51. … Read more

advertisement

Python Program to Find the Smallest Divisor of an Integer

This is a Python Program to find the smallest divisor of an integer. Problem Description The program takes in an integer and prints the smallest divisor of the integer. Problem Solution 1. Take in an integer from the user. 2. Use a for loop where the value of i ranges from 2 to the integer. … Read more

advertisement

Python Program to Convert Centimeters to Feet and Inches

This is a Python Program to read height in centimeters and then convert the height to feet and inches Problem Description The program reads the height in centimeters and then converts the height to feet and inches. Problem Solution 1. Take the height in centimeters and store it in a variable. 2. Convert the height … Read more

advertisement

Python Program to Check Leap Year

Problem Description Write a Python program that takes a year as input and checks whether it is a leap year or not. What is Leap Year? A leap year is a year that is divisible by 4 but not by 100, unless it is also divisible by 400. Leap years have an extra day, February … Read more

advertisement

Sum of Digits Program in Python

This is a Python Program to find the sum of digits in a number. Problem Description The program takes in a number and finds the sum of digits in a number. Problem Solution 1. Take the value of the integer and store in a variable. 2. Using a while loop, get each digit of the … Read more

advertisement

Python Program to Count the Number of Digits in a Number

This is a Python Program to count the number of digits in a number. Problem Description The program takes the number and prints the number of digits in the number. Problem Solution 1. Take the value of the integer and store in a variable. 2. Using a while loop, get each digit of the number … Read more

advertisement

Palindrome Program in Python

Problem Description Write a Python Program to check whether a given number is a palindrome. What is Palindrome? Palindrome number in Python is a number that remains the same when its digits are reversed. It reads the same forwards and backwards. To check if a number is a palindrome, we compare it with its reverse. … Read more

advertisement

Python Program to Check if a Date is Valid and Print the Incremented Date if it is

This is a Python Program to check if a date is valid and print the incremented date if it is. Problem Description The program takes in a date and checks if it a valid date and prints the incremented date if it is. Problem Solution 1. Take in the date of the form: dd/mm/yyyy. 2. … Read more

advertisement

Python Program to Reverse a Number

Problem Description Write a Python Program to reverse a given number. Problem Solution Reversing a number means changing the order of its digits. For example, if we reverse the number 124, we get 421. It involves rearranging the digits of the given number from right to left. There are several ways to reverse a number … Read more

advertisement

Python Program to Check Whether a Number is Positive or Negative

This is a Python Program to check whether a number is positive or negative. Problem Description The program takes a number and checks whether it is positive or negative. Problem Solution 1. Take the value of the integer and store in a variable. 2. Use an if statement to determine whether the number is positive … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.