Wednesday, July 29, 2020

Simple python Program to let you know which Article( A/An) to append before a word-[FREE CODE]

*****
Simple Python Program to let you know which Article( A/An) to append before a Word. This is a scalable program as it does not contain all the use cases/ special cases where An is used. Feel free to add those cases in the if block and share in the comments section.
*****
a = input("Enter a word : ")
vowels = ['a','e','i','o']
excep = ['ho']
other = ['un','eu']
if a[0] in vowels:
    print("AN will come before the word")
elif a[0] == "h" and a[1] == "o":
    print("AN will come before the word")
elif a[0] == "u" and a[1] == "n":
    print("A will come before the word")
elif a[0] == "u":
    print("An will come before the word")
else:
    print("A will come before the word")

Monday, July 27, 2020

Easy Python Program to count Vowels in a name or sentence.[Free Code]

*****
Vowel Counter
*****
import numpy as np
a = input("Enter a word : ")
b = []
v = len(a)
vowels = ['a','e','i','o','u','A','E','I','O','U']
for i in range(v):
if a[i] in vowels:
b.append(a[i])

x = np.array(b)
if len(b)!= 0:
print("THE VOWELS ARE :", b, len(b)," Vowels Found")
print("Unique Vowels are:",np.unique(x))
elif len(b)==0:
print(len(b), " VOWELS FOUND")
else:
print("Unexpected Error")

Tuesday, July 21, 2020

Leap Year Calculator [FREE CODE]

*****
This Python program tells the user whether the entered year is leap year or not. Seems Simple, But its a bit dicey..Give it a Try!!
*****

while True:

    a = int(input("Enter year : "))
    if a % 100 == 0:
        if a % 400 == 0:
            print("The year is leap")
        else:
            print("Not a leap Year")
    else:
        if a % 4 == 0:

            print("The year is leap")
        else:
            print("No leap")

Sunday, July 19, 2020

Python Program to Calculate Exposure Value from Aperture and Shutter Speed [Free Code]

ev = [[-4,-3,-2,-1,0,1,2,3,4,5,6],[-3,-2,-1,0,1,2,3,4,5,6,7],[-2,-1,0,1,2,3,4,5,6,7,8],[-1,0,1,2,3,4,5,6,7,8,9],[0,1,2,3,4,5,6,7,8,9,10]
,[1,2,3,4,5,6,7,8,9,10,11],[2,3,4,5,6,7,8,9,10,11,12],[3,4,5,6,7,8,9,10,11,12,13],[4,5,6,7,8,9,10,11,12,13,14],[5,6,7,8,9,10,11,12,13,14,15]
,[6,7,8,9,10,11,12,13,14,15,16],[7,8,9,10,11,12,13,14,15,16,17],[8,9,10,11,12,13,14,15,16,17,18],[9,10,11,12,13,14,15,16,17,18,19]
,[10,11,12,13,14,15,16,17,18,19,20],[11,12,13,14,15,16,17,18,19,20,21]]
#for r in ev:
# for c in r:
# print(c,end = " ")
# print()

print("""
Enter Shutter Speed as number specified in the table
15.0 0
8 1
4 2
2 3
1 4
1/2 5
1/4 6
1/8 7
1/15 8
1/30 9
1/60 10
1/125 11
1/250 12
1/500 13
1/1000 14
1/2000 15
""")
s = int(input(": "))


print("""
Enter Aperture as number specified in the table
f1.0 0
f1.4 1
f2 2
f2.8 3
f4 4
f5.6 5
f8 6
f11 7
f16 8
f22 9
f32 10

""")
a = int(input(": "))
uev = ev[s][a]
print("Your Exposure Value is ", uev)
if uev < 0 :
print(" Your Image is likely to be Underexposed")
elif uev > 4 :
print(" Your Image is likely to be Overexposed")
else:
print(" You might just get a good shot")


Saturday, July 18, 2020

Easy Python Program to know your BMI [FREE CODE]

*****
This short Python program finds out your Body Mass Index when you enter your weight and height. Check How Fit you are !!
*****



a = int(input("Enter your weight in kilograms : "))
b = int(input("Enter your height in cm : "))
c = b/100
e = float(a/c ** 2)
print("Your BMI is",round(e))
if e > 25:
    print("OHH NO ! YOU ARE OVERWEIGHT :(")
elif e >= 18.5 and e <= 24.9:
    print("YOU ARE FIT AND HEALTHY :)")
else:
    print("DEAR, YOU ARE UNDERWEIGHT :|")
***********************************************************************************
See Program in action




Friday, July 17, 2020

A Tree Planter Python Program [FREE CODE]

*****
This  Short n Sweet Python Program plants a Virtual Tree made up of  English Alphabets. Great Learning for Kids :)
*****

n = int(input("Enter Alphabets Tree Height:"))
if n <=26:
    j = 1
    for x in range(0,n):
        for y in range(n,x,-1):
            print(" ", end="")
        print(chr(x+65) * j, end="")
        j = j+2
        for w in range(n,x,-1):
            print("",end="")
        print()
else:
    print("English Language has only 26 Alphabets. Enter accordingly.")




Python Program for 8th standard Mathematics kids calculates Volume of a 3D object of your choice.[FREE CODE]

*****
This easy and simple Python code for 8th standard Mathematics kids calculates Volume of a 3D object of your choice. Its real fun and learning,Try it out!!
*****

while True:
    a = "cube"
    b = "cuboid"
    c = "cylinder"
    s = "sphere"
    p = "pyramid"
    d = input("""  What do U want to calculate? 
                   Type CUBE for volume of a CUBE
                   Type CUBOID for Volume of CUBOID
                   Type CYLINDER for Volume of CYLINDER
                   Type SPHERE for Volume of SPHERE
                   Type PYRAMID for Volume of  a PYRAMID : """)
    if a.lower() == d.lower():
        e = int(input("Enter edge of cube : "))
        print("*******Volume of cube is",round(e ** 3))
    elif b.lower() == d.lower():
        f = int(input("Enter length  of Cuboid: "))
        g = int(input("Enter base of Cuboid: "))
        h = int(input("Enter height of Cuboid : "))
        print("Volume of Cuboid is",round(f * g * h))
    elif c.lower() == d.lower():
        i = int(input("Enter radius of Cylinder: "))
        j = int(input("Enter height of Cylinder : "))
        print("Volume of Cylinder is",round(22/7 * (i) ** 2 * j))
    elif s.lower() == d.lower():
        k = int(input("Enter radius of Sphere : "))
        print("The Volume of Sphere is",round(4/3 * 22/7 * (k) ** 3))
    elif p.lower() == d.lower():
        l = int(input("Enter length of Pyramid : "))
        m = int(input("Enter width of Pyramid : "))
        n = int(input("Enter height of Pyramid : "))
        print("Volume of Pyramid is",round((l * m * n)/3))
    else:
        print("Enter Valid Entry.....NERD")


Thursday, July 16, 2020

Easy Python Program for predicting Zodiac Sign [ FREE CODE]

*****
This Python Program will tell you your Zodiac Sign, when you Enter your Date of Birth. Interesting! Isn't it ??!!
*****


while True:
    y = int(input("Enter year: "))
    m = int(input("Enter month: "))
    d = int(input("Enter date: "))
    from datetime import date
    my_date = date(y,m,d)
    if (my_date.month == 12 and my_date.day <= 23) or (my_date.month == 1 and my_date.day <= 19):
        print("Hello CAPRICORN")
    elif (my_date.month == 1 and my_date.day >= 20) or (my_date.month == 2 and my_date.day <= 19):
            print("Hello AQUARIAN")
    elif (my_date.month == 2 and my_date.day >= 20) or (my_date.month == 3 and my_date.day <= 20):
            print("Hello PISCEAN")
    elif (my_date.month == 3 and my_date.day >= 21) or (my_date.month == 4 and my_date.day <= 20):
            print("Hello ARIES")
    elif (my_date.month == 4 and my_date.day >= 21) or (my_date.month == 5 and my_date.day <= 20):
            print("Hello TAURUS")
    elif (my_date.month == 5 and my_date.day >= 21) or (my_date.month == 6 and my_date.day <= 20):
            print("Hello GEMINI")
    elif (my_date.month == 6 and my_date.day >= 21) or (my_date.month == 7 and my_date.day <= 22):
            print("Hello CANCER")
    elif (my_date.month == 7  and my_date.day >= 23) or (my_date.month == 8 and my_date.day <= 22):
            print("Hello LEO")
    elif (my_date.month == 8 and my_date.day >= 23) or (my_date.month == 9 and my_date.day <= 22):
            print("Hello VIRGO")
    elif (my_date.month == 9 and my_date.day >= 23) or (my_date.month == 10 and my_date.day <= 22):
            print("Hello LIBRA")
    elif (my_date.month == 10 and my_date.day >= 23) or (my_date.month == 11 and my_date.day <= 22):
            print("Hello SCORPIO")
    elif (my_date.month == 11 and my_date.day >= 23) or (my_date.month == 12 and my_date.day <= 21):
            print("Hello SAGITARIUS")
    else:
        print("Please Enter valid Date of Birth :)")