Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
21 views

50 Basic Question Python

Uploaded by

r8978428
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

50 Basic Question Python

Uploaded by

r8978428
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1. Write a Python program to find the sum of two numbers.

2. Write a Python program to check if a number is even or odd.

3. Write a Python program to calculate the factorial of a number.

4. Write a Python program to print the Fibonacci sequence up to 'n' terms.

5. Write a Python program to check if a number is prime.

6. Write a Python program to calculate the greatest common divisor (GCD) of two numbers.

7. Write a Python program to calculate the least common multiple (LCM) of two numbers.

8. Write a Python program to convert a decimal number to binary.

9. Write a Python program to find the sum of digits of a number.

10. Write a Python program to reverse a number.

11. Write a Python program to find the sum of the first 'n' natural numbers.

12. Write a Python program to find the sum of all even numbers between two given numbers.

13. Write a Python program to find the product of two numbers without using the '*' operator.

14. Write a Python program to count the number of digits in a number.

15. Write a Python program to check if a number is a palindrome.

16. Write a Python program to check if a number is an Armstrong number.

17. Write a Python program to swap two numbers without using a temporary variable.

18. Write a Python program to calculate the power of a number using a loop.

19. Write a Python program to print the multiplication table of a given number.

20. Write a Python program to find the largest of three numbers.

21. Write a Python program to find the smallest of three numbers.

22. Write a Python program to calculate the average of three numbers.

23. Write a Python program to check if a character is a vowel or consonant.

24. Write a Python program to count the number of vowels in a string.

25. Write a Python program to check if a character is an uppercase or lowercase letter.

26. Write a Python program to convert a lowercase letter to an uppercase letter.

27. Write a Python program to convert an uppercase letter to a lowercase letter.

28. Write a Python program to print the ASCII value of a character.

29. Write a Python program to check if a year is a leap year.

30. Write a Python program to find the area of a circle.

31. Write a Python program to find the area of a rectangle.


32. Write a Python program to find the area of a triangle given the base and height.

33. Write a Python program to find the circumference of a circle.

34. Write a Python program to calculate simple interest.

35. Write a Python program to calculate compound interest.

36. Write a Python program to check if a number is divisible by both 3 and 5.

37. Write a Python program to find the sum of all prime numbers between two given numbers.

38. Write a Python program to convert a Celsius temperature to Fahrenheit.

39. Write a Python program to convert a Fahrenheit temperature to Celsius.

40. Write a Python program to find the sum of squares of the first 'n' natural numbers.

41. Write a Python program to print all factors of a given number.

42. Write a Python program to find the largest factor of a number other than itself.

43. Write a Python program to calculate the square root of a number without using built-in
functions.

44. Write a Python program to count the number of occurrences of a character in a string.

45. Write a Python program to print a pyramid pattern of stars.

46. Write a Python program to print an inverted pyramid pattern of stars.

47. Write a Python program to calculate the sum of all odd numbers between two given numbers.

48. Write a Python program to calculate the sum of all multiples of 3 or 5 below 1000.

49. Write a Python program to reverse the digits of a number without converting it to a string.

50. Write a Python program to check if a number is a perfect number.

You might also like