Write a Python program that takes a string as an input from the user containing all small letters and then prints the next alphabet in sequence for each alphabet in the input.
Hint: You may need to use the functions ord() and chr(). The ASCII value of ‘a’ is 97 and ‘z’ is 122.
Write a Python program that will ask the user to input a string (containing exactly one word). Then your program should print subsequent substrings of the given string as shown in the examples below.
=====================================================================
Hints(1): You may use "for loop" for this task.
Hints(2): You may use print() function for printing newlines.
For example:
print(1)
print(2)
Output:
1
2
=====================================================================
We can use print(end = "") to skip printing the additional newline.
For example:
print(1, end ="")
print(2)
Output:(prints the following output right next to the previous one)
12
=====================================================================
Sample Input 1:
BANGLA
Sample Output 1:
B
BA
BAN
BANG
BANGL
BANGLA
.
=====================================================================
Sample Input 2:
DREAM
Sample Output 2:
D
DR
DRE
DREA
DREAM
Write a Python program that will ask the user to enter a word as an input.
Machine problem 2
Create a Python script that will generate random n integers from a given start and end of a range.
Sample Output:
Value for n:5
Value for start: 1
Value for end : 10
10 8 7 8 3
Create two numpy arrays and add the elements of both the arrays and store the result in sumArray.
Part 1
Write a Python program that does the following.
Part 2
Provide your own examples of the following using Python lists. Create your own examples. Do not copy them from another source.
Provide the Python code and output for your program and all your examples.
Add methods to the classes and subclasses:
In the main code:
1. In K-means algorithm, what is the most commonly used distance metric to calculate distance between centroid of each cluster and data points?
a)Chebyshev distance
b)Manhattan
c)Euclidean
d)None of the above
1. Which of the following statement is not correct about k-means?
a)Accuracy of cluster are improved by scaling of attributes.
b)K-means clusters are affected by outliers.
c)K-Means clustering is NOT influenced by initial centroids which are called cluster seeds
d)Number of clusters to be built is typically an user input and it impacts the way clusters are created
1. The method / metric which is NOT useful to determine the optimal number of clusters in unsupervised clustering algorithms is
a)Dendogram
b)Elbow method
c) Scatter plot
d) None of the above