Professional Documents
Culture Documents
Assessment
1.import mathuser_input = [4, 18, 16, 25]
sqare_roots = [math.sqrt(num) for num in user_input]
print(sqare_roots)
2.def divisible_by_3_and_5():
for num in range(1, 101):
if num % 3 == 0 and num % 5 == 0:
print(num)
3-def check_vowel_or_consonant(letter):
vowels = 'aeiouAEIOU'
if letter in vowels:
print(f"{letter} is a vowel.")
else:
print(f"{letter} is a consonant.")
4-char1 = chr(40)
char2 = chr(170)
5- def count_vowels(input_string):
vowels = 'AEIOUaeiou' # All uppercase and lowercase
vowels
vowel_count = sum(1 for char in input_string if char in
vowels)
return vowel_count
input_string = "ABCDEFGHIJKLMNO"
result = count_vowels(input_string)
print(f"The number of vowels in the string is: {result}")
6- # Uppercase alphabets
print("Uppercase Alphabets:")
for i in range(65, 91): # ASCII codes for A-Z
print(chr(i), end=' ')
print("\n")
# Lowercase alphabets
print("Lowercase Alphabets:")
for i in range(97, 123): # ASCII codes for a-z
print(chr(i), end=' ')
7-def sum_even_numbers(lst):
total = sum(num for num in lst if num % 2 == 0)
print(f"Sum of even numbers in the list: {total}")
print(concatenated_string)
print(odd_numbers)
print(output_string)