PROGRAMMING QUESTIONS
Question-1:
You are developing a program to process date information. Prompt the user to
input a date in the format 'dd-mm-yyyy' with the day, month, and year separated
by a hyphen (-).
Strings
Question-2:
Write a Python program to print substrings of a given string using positive and
negative indexing.
Question-3:
Reversing a String:
Write a Python program to reverse a given string using string indexing. Prompt
the user to input a string and print its reversed form.
Question-4:
Counting Occurrences:
Write a Python program to count the occurrences of a specific character in a
given string. Prompt the user to input a string and a character to count, then
print the number of times that character appears in the string.
Question-5:
Palindromes:
Write a Python function to check if a string is a palindrome.
Question-6:
Extracting Even and Odd Characters:
Write a Python program to extract and print the even-indexed and odd-indexed
characters separately from a given string. Prompt the user to input a string and
print the characters at even indices and odd indices.
List:
Question-7:
Python program to interchange first and last elements in a list
Question-8:
Write a Python program to calculate the sum of all elements in a given list.
Question-9:
Write a Python program to concatenate two lists.
Question-10:
Write a Python program to remove all occurrences of a specified element from a
given list.
Question-11:
Write a Python program to search for a specified element in a given list and
return its index if found.
Question-12:
List Duplication:
Write a Python program to create a new list containing duplicate elements of a
given list.
CONDITIONAL STATEMENTS
Leap Year Checker:
Write a program to determine whether a given year is a leap year or not. A year is a leap year
if it is divisible by 4, except for years divisible by 100 that are not divisible by 400.
Triangle Type:
Given three integers representing the lengths of the sides of a triangle, determine whether the
triangle is equilateral, isosceles, scalene, or not a triangle at all.
Grade Calculator:
Write a program that takes input for a student's score and outputs the corresponding letter
grade based on the following grading scale:
A: 90-100
B: 80-89
C: 70-79
D: 60-69
F: Below 60
Odd-Even Counter:
Write a program that takes a list of integers as input and counts the number of odd and even
numbers in the list.
Largest of Three Numbers:
Write a program that takes three integers as input and outputs the largest of the three
numbers.
Simple Calculator:
Write a program that takes input for two numbers and an arithmetic operator (+, -, *, /) and
performs the corresponding operation.
Number Guessing Game:
Write a program that generates a random number between 1 and 100 and allows the user to
guess the number. Provide feedback (too high, too low, or correct) based on the user's input.
Nested For Loop