Question

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 expre Python please
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Python 3.7.0 Shell File Edit Shell Debug Options Window Help after a + [-2] list looks like this [4, 7.0, 4.0, -2] after a +Fle Edit Format Run Options Window Help for i in range(len(a)): alil ali]+3 printf a +3-) printfafter a[o] 4 list looks likProblem 2py-CrUsers Dell Deaktop Problem 2py 13.70) File Edit Format Run Options Window Help a [-1,8,2] c- numpy.array(I1,1,2

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 :)

Add a comment
Know the answer?
Add Answer to:
2. For the list a - 1-1,8,21,tuple b-(5,1,-3), and ndarray c -np.array (11,1,21) determine the re...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 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,...

    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...

    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...

  • ΔΑΒΟ-withA(-5,2), B(-3,3), and C-1,Ok ΔDEF WRh D(3-0). E(5,1 ), and F07,-2); Prove: AABC ADEF Read the following proof for this protlem carefully, and then follow the directions with A , B-3,3),...

    ΔΑΒΟ-withA(-5,2), B(-3,3), and C-1,Ok ΔDEF WRh D(3-0). E(5,1 ), and F07,-2); Prove: AABC ADEF Read the following proof for this protlem carefully, and then follow the directions with A , B-3,3), and C(-1.0 Fwith DX3.0,ES,1), and FO.-2 B-5and DE Match the numbered blanks with the phrases, words, expressions, or statemenits that correctily ill in the corresponding blanks in the proaf blank t blank 2 Distance forrmula blank 3 Transtive Property of Equality blank 4 AC- V20 and DF- blank 5...

  • show work plz Consider the following finite state diagram. State 1 Output=1 State 0 Output=0 State...

    show work plz Consider the following finite state diagram. State 1 Output=1 State 0 Output=0 State 2 Output=1 State 3 Output=0 The diagram has 4 states, 1 external input / (in additional to the CLK input), and 1 output bit Y. State 0 is represented by memory bits Qi Qo=00, State 1 is represented by memory bits Q.Qo=01, State 2 is represented by memory bits Q.Qo = 10, and State 3 is represented by memory bits Q.Qo = 11. The...

  • Create a Python list (use first three letters of your name followed by the letter L...

    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...

  • Label the orbitals described by each of the following sets of quantum numbers. (a) n 4,1 1 (b) n 7,1-0 (c) n 5,1-3 S...

    Label the orbitals described by each of the following sets of quantum numbers. (a) n 4,1 1 (b) n 7,1-0 (c) n 5,1-3 Submit Answer Try Another Version 3 item attempts remaining

  • Solve problem by how a,b,c,d, and e state 2. 3.5.9 (12 pts total) (a) Write the...

    Solve problem by how a,b,c,d, and e state 2. 3.5.9 (12 pts total) (a) Write the kinematic quantities F, T,ã using variables a, y as the co- (b) Draw a FBD, compute the resultant force vector, and write the vector (c) Dot your vector EOM with n to get a scalar EOM for . Integrate (d) Dot the vector EOM with ny to get a scalar EOM for j. Integrate (e) Complete the problem asked: write an expression for N...

  • Page 3 of 7 (Python) For each substring in the input string t that matches the...

    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...

    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,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT