Asnmt 4
Asnmt 4
1.Write a Python program that uses the `range()` function to generate a list of all the multiples of
5 between 1 and 100 (inclusive).
2.Write a Python program that takes a list of names and searches for a specific name entered by
the user. If the name is found, print `"Name found!"` and stop searching using the `break`
statement. If the name is not found, print `"Name not found."`.
3.Write a Python program that loops through a list of integers and skips over all negative
numbers using the `pass` statement. It should print only the positive numbers.
4.Write a Python program that uses the `range()` function to iterate through numbers from 1 to
50. The program should stop the iteration if a number is divisible by both 4 and 6, and print
`"Found number divisible by 4 and 6"`.
5.Write a Python function `remove_duplicates(lst)` that removes duplicates from a list and
returns a new list with only unique elements, but the order of the elements should remain the
same.
6.Write a Python function that takes a string and searches for the first occurrence of any vowel
(`a, e, i, o, u`). If a vowel is found, print `"Vowel found: [vowel]"` and stop the search using the
`break` statement. If no vowel is found, print `"No vowels found."`
7.Write a Python program that creates two lists: one containing the even numbers from 1 to 20,
and the other containing the odd numbers from 1 to 20. Use the `range()` function.
8.Write a Python function `find_first_lowercase(s)` that takes a string `s` and returns the first
lowercase letter found in the string. Use the `pass` statement to handle cases where the character
is uppercase.
9.Write a Python program that reverses a list of integers without using built-in functions like
`reversed()` or `list.reverse()`.
10.Write a Python program that takes a list of numbers and prints only the positive numbers. If a
number is zero, the program should skip it using the `continue` statement. If a negative number is
found, the program should stop the search using the `break` statement.