Sample Program for input using dict() in Python

d = {}
name = input("Enter your name : ")
age = int(input("Enter your age : "))
fav_movie = input("Enter the name of your favourite movies separated by comma : ").split(',')
fav_song = input("Enter the name of your favourite songs separated by comma : ").split(',')

d = dict(name = name, age= age, fav_movie = fav_movie, fav_song = fav_song)

for i, j in d.items():
    print(f"The key is {i} for which the value is {j}")

logspace() in Python

Syntax : numpy.logspace(start, stop, num = 50, endpoint = True, base = 10.0, dtype = None)

Def : Returns number spaces evenly w.r.t interval on a log scale.

Sample Program

import numpy as py

arr = py.logspace(1, 8, num=5, base=10, dtype=int)

for elements in arr:
    print(elements)

for elements in range(len(arr)):
    print(arr[elements], end = " ")

linspace() in Python

Syntax : numpy.linspace(start, stop, num = 50, endpoint = True, retstep = False, dtype = None)

Def : Returns number spaces evenly w.r.t interval. Similar to arange but instead of step it uses sample number.

Sample Program

import numpy as py

arr = py.linspace(1, 8, num=5, dtype=int, endpoint=False)

for items in arr:
    print(items)

for items in range(len(arr)):
    print(arr[items])