In python: For a string s, and a character as input, create a function that will print each character of s but when the character input appears in the string add an asterisk beside the matching character. Each time the letter appears add an extra asterisk.
make this a function and use for i in range()
Interleave Strings
Given two strings, write a program to merge the given two strings by adding characters in alternating order, starting with the first string. If a string is longer than the other, append the additional characters onto the end of the merged string.Input
The first line of input will contain a string.
The second line of input will contain a string.
The strings may contain special characters, digits and letters.Output
The output should be the merged stringExplanation
For example, if the given strings are "abc" and "pqrs", then alternating characters from each string are merged as "a" from "abc", "p" from "pqr", "b" from "abc" and so on ..., resulting in the merged string "apbqcr".
input:
5
0 -2
3 6
4 7
1 -3
expected output : 7x^4 + 6x^3 - x^2 - 3x - 2
your output: 7x^4 + 6x^3 - 1x^2 - 3x - 2
for this code this is the error
and i am using python 3.9
Given polynomial, write a program that prints polynomial in Cix^Pi + Ci-1x^Pi-1 + .... + C1x + C0 format.
input : 5
0 2
1 3
2 1
4 7
expected output : 7x^4 + 6x^3 - x^2 - 3x - 2
your output: 7x^4 + 6x^3 - 1x^2 - 3x - 2please explain this why this is again show error
i am using python 3.9 version
now for this code this is the error throwing: please kindly rectify it as soon as possible
Errors/Warnings:
Traceback (most recent call last):
File "main.py", line 18, in <module>
print(sec_msg(input(),key))
EOFError: EOF when reading a line
for this code
input:
4
0 5
1 0
2 10
3 6
4
0 -5
1 0
2 -10
3 -6
output:
(nothing)
expected output:
2. The shape of a lima¸con can be defined parametrically as
r = r0 + cos θ
x = r cos θ
y = r sin θ
When r0 = 1, this curve is called a cardioid. Use this definition to plot the shape of a limacon for r0 = 0.8, r0 = 1.0, and r0 = 1.2. Be sure to use enough points that the curve is closed and appears smooth (except for the cusp in the cardioid). Use a legend to identify which curve is which.
1. Use matplotlib.pyplot.plot to produce a plot of the functions f(x) = e−x/10 sin(πx) and g(x) = xe−x/3 over the interval [0, 10]. Include labels for the x- and y-axes, and a legend explaining which line is which plot.
Define the following vectors and matrices:
vec1 = np.array([ -1., 4., -9.])
mat1 = np.array([[ 1., 3., 5.], [7., -9., 2.], [4., 6., 8. ]]
13. The function np.random.rand can be used to construct and fill vectors and matrices with random numbers. Use the help facility in Python to learn how to construct a 10 × 10 matrix named M filled with random numbers.
Define the following vectors and matrices:
vec1 = np.array([ -1., 4., -9.])
mat1 = np.array([[ 1., 3., 5.], [7., -9., 2.], [4., 6., 8. ]]
10. What function would you use to find the value of j so that vec1[j] is equal to the smallest element in vec1?
11. What expression would you use to find the smallest element of the matrix
mat1?