Variables Exervice
Variables Exervice
📌 Boolean Exercises
24.Declare two boolean variables and use AND, OR, and NOT operators.
25.Take an integer input and check if it is greater than 100 (output should be
True/False).
26.Write a Python program that returns True if a number is positive and
False if negative.
27.Check whether a given number is divisible by both 3 and 5.
28.Create a simple login system that verifies a user’s username and password
(boolean check).
29.Write a program to check if a given year is a leap year.
30.Take a user's age as input and check if they are eligible to vote (age ≥ 18).
📌 String Exercises
31.Take a user’s full name as input and print the first and last name
separately.
32.Write a program to count the number of vowels in a given string.
33.Convert a string into uppercase and lowercase.
34.Ask the user for a sentence and replace all spaces with hyphens.
35.Reverse a given string without using built-in functions.
36.Write a program that checks if a given word is a palindrome.
37.Ask the user for their name and display a greeting message using f-
strings.
38.Extract the domain name from an email address.
39.Take two strings and concatenate them using different methods (+, join,
format, f-string).
40.Write a program to find the longest word in a sentence.
This set of 57 questions covers all fundamental variable data types in Python,
providing a wide range of exercises from beginner to advanced levels.