Tag Archives: python example

Python Example – Write a Python program to convert month name to a number of days

(Python Example for Citizen Data Scientist & Business Analyst)   Write a Python program to convert month name to a number of days.   Sample Solution: Python Code: print(“List of months: January, February, March, April, May, June, July, August, September, October, November, December”) month_name = input(“Input the name of Month: “) if month_name == “February”: …

Python Example – Write a Python program to check whether an alphabet is a vowel or consonant

(Python Example for Citizen Data Scientist & Business Analyst)   Write a Python program to check whether an alphabet is a vowel or consonant.   Sample Solution: Python Code: l = input(“Input a letter of the alphabet: “) if l in (‘a’, ‘e’, ‘i’, ‘o’, ‘u’): print(“%s is a vowel.” % l) elif l == …

Python Example – Write a Python program to print alphabet pattern ‘L’

(Python Example for Citizen Data Scientist & Business Analyst)   Write a Python program to print alphabet pattern ‘L’.   Sample Solution: Python Code: result_str=””; for row in range(0,7): for column in range(0,7): if (column == 1 or (row == 6 and column != 0 and column < 6)): result_str=result_str+”*” else: result_str=result_str+” ” result_str=result_str+”n” print(result_str); …

Python Example – Write a Python program to find numbers between 100 and 400 (both included) where each digit of a number is an even number

(Python Example for Citizen Data Scientist & Business Analyst)   Write a Python program to find numbers between 100 and 400 (both included) where each digit of a number is an even number. The numbers obtained should be printed in a comma-separated sequence.   Sample Solution: Python Code: items = [] for i in range(100, …