Age-Calculator

Wed 11 March 2026
from datetime import datetime
def get_age(d):
    d1 = datetime.now()
    months = (d1.year - d.year) * 12 + d1.month - d.month

    year = int(months / 12)
    return year
age = get_age(datetime(1991, 1, 1))
age
33



Score: 5

Category: basics


Funcrtions

Wed 11 March 2026
def vowels_present(strx):
    count=0
    for char in strx:
        if char in ("a","e","i","o","u"):
            count = count + 1
    print(count)
    return(strx)

stry = str(input("Enter str: "))
result = vowels_present(stry)
print("the numbers of vowels present is: ",result) 
#problems on args:

def sum_all(*numbers):
    return sum(numbers)
print …

Category: basics

Read More

Looping

Wed 11 March 2026
print("hello world")
hello world
##sum of elements in a user entered list
arr = []
j=0
n = int(input("enter number of elements: "))
for i in range (n):
    elements = int(input("enter element: "))
    arr.append(elements)
print("elements entered are: ",arr)

sum=0
while j <= n:
    sum=sum+arr[i …

Category: basics

Read More
Page 1 of 1