(Python Example for Citizen Data Scientist & Business Analyst) Write a Python program to sum of two given integers. However, if the sum is between 15 to 20 it will return 20. Sample Solution: Python Code: def sum(x, y): sum = x + y if sum in range(15, 20): return 20 else: return …
(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 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 for Citizen Data Scientist & Business Analyst) Write a Python program to print alphabet pattern ‘M’. Sample Solution: Python Code: result_str=””; for row in range(0,7): for column in range(0,7): if (column == 1 or column == 5 or (row == 2 and (column == 2 or column == 4)) or (row …
(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 for Citizen Data Scientist & Business Analyst) Write a Python program to print alphabet pattern ‘G’. Sample Solution: Python Code: result_str=””; for row in range(0,7): for column in range(0,7): if ((column == 1 and row != 0 and row != 6) or ((row == 0 or row == 6) and column …
(Python Example for Citizen Data Scientist & Business Analyst) Write a Python program to print alphabet pattern ‘E’. Sample Solution: Python Code: result_str=””; for row in range(0,7): for column in range(0,7): if (column == 1 or ((row == 0 or row == 6) and (column > 1 and column < 6)) or (row …
(Python Example for Citizen Data Scientist & Business Analyst) Write a Python program to print alphabet pattern ‘D’. Sample Solution: Python Code: result_str=””; for row in range(0,7): for column in range(0,7): if (column == 1 or ((row == 0 or row == 6) and (column > 1 and column < 5)) or (column …
(Python Example for Citizen Data Scientist & Business Analyst) Write a Python program to print alphabet pattern ‘A’. Sample Solution: Python Code: result_str=””; for row in range(0,7): for column in range(0,7): if (((column == 1 or column == 5) and row != 0) or ((row == 0 or row == 3) and (column …
(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, …