import numpy
a = [-1,8,2]
b = (5,1,-3)
c = numpy.array([1,1,2])
for i in range(len(a)):
a[i] = a[i] * 0.5
print("a * 0.5 = ",a)
for i in range(len(a)):
a[i] = a[i] + 3
print("a + 3 = ",a)
a[0] = 4
print("after a[0] = 4 list looks like this",a)
a = a + [-2]
print("after a + [-2] list looks like this",a)
a = a + [-2]*2
print("after a + [-2]*2 list looks like this",a)
print("\n")
c = c * 0.5
print("c * 0.5 = ",c)
c = c + 3
print("c + 3 = ",c)
c[0] = 4
print("after c[0] = 4 list looks like this",c)
print("\n")
for i in range(len(b)):
b[i] = b[i] * 0.5
print("b * 0.5 = ",b)
you have any query then plz ask me without any hesitation in the
comment section below, if you like my answer then please thumbs up
for the answer, before giving thumbs down please discuss the
question it may possible that we may understand the question
different way and we can edit and change the answers if you agree,
thanks :)
Python please 2. For the list a - 1-1,8,21,tuple b-(5,1,-3), and ndarray c -np.array (11,1,21) determine...
Python please
2. For the list a - 1-1,8,21,tuple b-(5,1,-3), and ndarray c -np.array (11,1,21) determine the results of the following expressions and place them in the spaces on the right of the table. If the expression would return an error, write "error" as the result. Note that each expression is independent of the others. (12 pts) Expression Results a*o.5 b*o.5 c*o.s a+3 b+3 c+3 a+I-2] at[-2] *2 a [O] -4; print (a) ; bt0-4; print (b) c[0] -4; print...
In Python import numpy as np Given the array a = np.array([[1, 2, 3], [10, 20, 30], [100, 200, 300]]), compute and print the sums over all rows (should give [6, 60, 600]) the sums over all columns (the sum of he first column is 111) the maximum of the array the maxima over all rows the mean of the sub-array formed by omitting the first row and column the products over the first two columns (hint: look for an...
Write the program in Python!
We want to evaluate the integral integral_0^1 e^-t^2 dt. Write a Python (or C, etc.) function that computes the integral above using the composite Simpson method with N subintervals of [0, 1]: here N is the input parameter. We assume N lessthanorequalto 200. Run this program and print the output when N = 10, 50, 100. Use the error formula of the composite Simpson method to find an upper bound on the error for this...
Python Please. a)Let a program store the result of applying the eval function to the first command-line argument. Print out the resulting object and its type. Run the program with different input: an integer, a real number, a list, and a tuple. (On Unix systems you need to surround the tuple expressions in quotes on the command line to avoid error message from the Unix shell.) Try the string "this is a string" as a commandline argument. Why does this...
Create a Python list (use first three letters of your name followed by the letter L as the name of the list.) with the following data: 10, 20.0, 50.00, 7000, 7500, 7700, 7800, 8000, 9000, ‘python’. Display the entire list with an appropriate message. Display the 4th element in the list with an appropriate message. Display the first 3 values of the list only. Display all the values starting from the sixth element to the end of the list. Change...
use python IDEL
Please highlight the answer
1 ווCIוסטIT Errors and Exceptions. There are two main types of errors: syntax errors and runtime errors. Syntax errors are detected by the Python interpreter before the program execution during the parsing stage (parsing is a process, during which the Python interpreter analyzes the grammatical structure of the program). Runtime errors are errors in a program that are not detected by the Python interpreter during its parsing stage. They are further divided into...
please help to solve the following problem on python 3.0 please Translate the following problem descriptions into Python. If score is greater than or equal to 90, then grade is set to ‘A’. a) Assume the variables p, v, and r have been assigned some values we want to test. If the expression t / (p – v) is greater than 10, then r is set to 0. If the result is not greater than 10, r is set to...
Page 3 of 7 (Python) For each substring in the input string t that matches the regular expression r, the method call re. aub (r, o, t) substitutes the matching substring with the string a. Wwhat is the output? import re print (re.aub (r"l+\d+ " , "$, "be+345jk3726-45+9xyz")) a. "be$jk3726-455xyz" c. "bejkxyz" 9. b. "be$jks-$$xyz" d. $$$" A object a- A (2) 10. (Python) What is the output? # Source code file: A.py class A init (self, the x): self.x-...
Greeting! Kindly help me to solve my finals in PYTHON, I don't have a knowledge in PYTHON, new student. Please, please, I'm begging, Kindly answers all the questions. I'm hoping to grant my request. Thanks in advanced. 1.) What is the output of the following snippet? l1 = [1,2] for v in range(2): l1.insert(-1,l1[v]) print(l1) a.) [1, 2, 2, 2] b.) [1, 1, 1, 2] c.) [1, 2, 1, 2] d.) [1,...
Python: 1) What output is generated by the following code segment? table = [["T", "U", "V"], ["W", "X", "Y"]] print(table[0]) Group of answer choices a- T b- ["T", "W"] c- ["T", "U", "V"] d- [["T", "U", "V"], ["W", "X", "Y"]] 2) Consider the following code segment: values = [4, 12, 0, 1, 5] print(values[1]) What is displayed when it runs? Group of answer choices a- 0 b- 1 c- 4 d- 12 3) Consider the following code segment: x =...