How to print the star(*) pattern without newline and space?
Code to print the star(*) pattern without newline and space: for i in range(0, 20): print('*', end="")
Code to print the star(*) pattern without newline and space: for i in range(0, 20): print('*', end="")
From Python 3+, there is an additional parameter introduced for print() called end=. This parameter takes care of removing the newline that is added by default in print(). In the…
str_list = "Welcome to Guru99" age = 50 pi = 3.14 c_num = 3j+10 my_list = my_tuple = ("A", "B", "C", "D") my_dict = {"A":"a", "B":"b", "C":"c", "D":"d"} my_set =…
Code to get index of an element in a list using for loop: my_list = all_indexes = for i in range(0, len(my_list)) : if my_list == 'Guru' : all_indexes.append(i) print("Originallist…
count duplicate elements in a given list list1 = elm_count = list1.count(3) print('The count of element: 3 is ', elm_count)
Here, is a Code for list count: list1 = color_count = list1.count('green') print('The count of color: green is ', color_count)
Here is a code to find average via loop: def cal_average(num): sum_num = 0 for t in num: sum_num = sum_num + t avg = sum_num / len(num) return avg…
Slicing will return you the elements from the matrix based on the start /end index given. The syntax for slicing is: If the start index is not given, it is…
Code for matrix multiplication import numpy as np M1 = np.array(, ]) M2 = np.array(, ]) M3 = M1.dot(M2) print(M3)
Phyhon code for matrix subtraction import numpy as np M1 = np.array(, , ]) M2 = np.array(, , ]) M3 = M1 - M2 print(M3)