0% found this document useful (0 votes)
5 views2 pages

Question To Try

Uploaded by

Saran Sk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Question To Try

Uploaded by

Saran Sk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

1)Write a Python program to check whether a given integer is **even or odd**.

2)Write a Python program to **count the number of vowels** in a given string.


3)Write a Python program to **find the largest number** in a list.
4)Write a Python program to **count the frequency of each character** in a string
using a dictionary.
5)Write a Python program to check if a given number is **both positive and even**.
Use Boolean logic.
6)Write a program to print the sum of the first 20 positive integers.
7)Write a program to check if a number is a **prime number**.
8)Write a program to **count uppercase and lowercase letters** in a string.
9)Write a program to reverse a string **using a while loop**.
10)Write a program to print **all even numbers** from a list.
11)Write a program to calculate the **sum of positive numbers only** in a list.
12)Write a program to print each **key and value** in a dictionary.
13)Write a program to check if a key exists in a dictionary.
14)Write a program to check if a user is eligible to vote (age >= 18 and citizen ==
True).
15)Write a program that keeps asking the user to enter a **positive number** until
they do.
16)**Armstrong Number Checker**
Check whether a number is an **Armstrong number** (e.g., 153 = 1³ + 5³ + 3³).
17)**Reverse Digits Without String Conversion**
Given a positive integer, **reverse its digits** without converting it to a string.
18)**Digital Root**
Keep summing the digits of a number until a **single-digit** number is obtained.
*Example:* 987 → 9+8+7 = 24 → 2+4 = **6**
19)**Anagram Checker**
Write a program to check if two strings are **anagrams** (contain the same
characters in a different order).
20)**Palindrome Ignoring Spaces and Case**
Check if a sentence is a **palindrome** (ignoring spaces, punctuation, and case).
21)**Longest Word Finder**
Find the **longest word** in a given sentence.
22)**Second Largest Unique Number**
Find the **second largest unique number** in a list without using `sort()`.
23)**Find Missing Number**
A list contains numbers from 1 to 100, but one number is missing. Find it **without
using loops over the full range**.
24)**Remove Duplicates Without Set**
Remove all **duplicate elements** from a list manually (i.e., without using `set()`
or libraries).
25)**Invert a Dictionary**
Given a dictionary, invert it — swap keys and values.
*Example:* `{"a": 1, "b": 2}` → `{1: "a", 2: "b"}`
26)**Q11. Most Frequent Value**
Find the **most frequent value** in a dictionary.
27)**Merge Two Dictionaries with Summed Values**
Merge two dictionaries by **adding values of common keys**.
*Example:*
```python
dict1 = {'a': 5, 'b': 2}
dict2 = {'a': 3, 'c': 4}
# Result → {'a': 8, 'b': 2, 'c': 4}
```
28)**Truth Table Evaluator**
Ask the user for two boolean values and print the result of:
* AND
* OR
* NOT (on each)
* XOR
---
29)**Password Strength Checker**
Check if a password is **strong** using Boolean logic:
* At least 8 characters
* Contains a digit
* Contains an uppercase letter
* Contains a symbol
---
30)**Login System with Limited Attempts**
Simulate a login system that gives the user **3 attempts** to enter the correct
password. After 3 failed tries, it locks them out.

You might also like