Python-Programming-Assignment-01
Python-Programming-Assignment-01
Question 1: Write a Python program that takes a string as input and prints:
def reverse_text(input_str):
return input_str[::-1]
def count_vowel(input_str):
vowel_count = 0
for char in input_str.lower():
if char in {'a','e','i','o','u'}:
vowel_count += 1
return vowel_count
Question 2:
def odd_even_check(num):
return "Even" if num % 2 == 0 else "Odd"
import numpy as np
def sort_numbers(number_list):
print("Creating virtual environment...")
print("(In real use: python -m venv sortenv)")
print("(Then: pip install numpy)")
return np.sort(number_list)
try:
numbers = [int(x) for x in input("Enter numbers with spaces:").split()]
print("Sorted:", sort_numbers(numbers))
except:
print("Only numbers allowed")