Day: February 18, 2021

Python Example – Write a Python program to extract single key-value pair of a dictionary in variables

Hits: 12 (Python Example for Citizen Data Scientist & Business Analyst)   Write a Python program to extract single key-value pair of a dictionary in variables.   Sample Solution Python Code: d = {‘Red’: ‘Green’} (c1, c2), = d.items() print(c1) print(c2) Sample Output: Red Green   Write a Python program to extract single key-value pair …

Python Example – Write a Python program to calculate the time (difference between start and current time)of a program

Hits: 9 (Python Example for Citizen Data Scientist & Business Analyst)   Write a Python program to calculate the time runs (difference between start and current time) of a program.   Sample Solution Python Code: from timeit import default_timer def timer(n): start = default_timer() for row in range(0,n): print(row) print(default_timer() – start) timer(5) timer(15) Sample …