1. (5 pts) Translate the following formula into a python arithmetic expression: (as + b) 7...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. (5 pts) Translate the following formula into a python arithmetic expression: (as + b) 7 6-8cd 2. (5 pts) Assume that you have a variable called myString that has been assigned a string value at least 9 characters long. Write a print statement that will print out the fourth character and the seventh character in myString using indexes. This is just one print statement, and there are two things to print - each of the characters mentioned. 3. (5 pts) Write a single expression whose value is True only when the value of a variable called y is an even number that is larger than O. NO need to initialize any variables, assume y has been assigned an integer value. You must use relational/comparison and/or Boolean operators to solve this problem. 4. (5 pts) Write a SINGLE Python statement that will input a value, convert it to an integer and assign the value to a variable called val. 5. (5 pts) Translate the binary number 100111 into decimal. You must show your work in order to get credit for this problem. 7. (a) (4) Write an example of a list literal that contains two items. One of these items should be a string literal and the other one should be a list literal containing three items - a floating point number, an int, and a string literal. (b) (2) What is the length of the list you wrote down for part (a)- figure it out by hand. 8. (9) Evaluate each of the following python expressions and write its value (a) 6%9 (b) 5//3 (c) 6/2 9. (10) Assume you have input three unique (they all have different values) values into variables named x, y, and z. Write one or more if statements in python that determine and print the value of the largest of these three. NO using lists, built-in functions like max(), etc. You must do this "by hand", you must compare these variables using binary relational operators. That just means you are comparing two values at a time, like x > y. Do not use the three part comparison operator! 10. (10) Write a while loop that runs 6 times. Each time input a word. If the word starts with a vowel (the vowels are a, e, I, o, u, and A, E, I, O, U) the print 'V', if not print 'C'. 11. (10) Write a while loop that inputs numbers from a user until they type the number 0. They should be read in as integers. Print the numbers out that you read in, and count how many numbers the user types. Print out the number of numbers the user typed after the loop ends. 1. (5 pts) Translate the following formula into a python arithmetic expression: (as + b) 7 6-8cd 2. (5 pts) Assume that you have a variable called myString that has been assigned a string value at least 9 characters long. Write a print statement that will print out the fourth character and the seventh character in myString using indexes. This is just one print statement, and there are two things to print - each of the characters mentioned. 3. (5 pts) Write a single expression whose value is True only when the value of a variable called y is an even number that is larger than O. NO need to initialize any variables, assume y has been assigned an integer value. You must use relational/comparison and/or Boolean operators to solve this problem. 4. (5 pts) Write a SINGLE Python statement that will input a value, convert it to an integer and assign the value to a variable called val. 5. (5 pts) Translate the binary number 100111 into decimal. You must show your work in order to get credit for this problem. 7. (a) (4) Write an example of a list literal that contains two items. One of these items should be a string literal and the other one should be a list literal containing three items - a floating point number, an int, and a string literal. (b) (2) What is the length of the list you wrote down for part (a)- figure it out by hand. 8. (9) Evaluate each of the following python expressions and write its value (a) 6%9 (b) 5//3 (c) 6/2 9. (10) Assume you have input three unique (they all have different values) values into variables named x, y, and z. Write one or more if statements in python that determine and print the value of the largest of these three. NO using lists, built-in functions like max(), etc. You must do this "by hand", you must compare these variables using binary relational operators. That just means you are comparing two values at a time, like x > y. Do not use the three part comparison operator! 10. (10) Write a while loop that runs 6 times. Each time input a word. If the word starts with a vowel (the vowels are a, e, I, o, u, and A, E, I, O, U) the print 'V', if not print 'C'. 11. (10) Write a while loop that inputs numbers from a user until they type the number 0. They should be read in as integers. Print the numbers out that you read in, and count how many numbers the user types. Print out the number of numbers the user typed after the loop ends.
Expert Answer:
Answer rating: 100% (QA)
1 Python arithmetic expression for the given formula python result a 5 b 2 7 6 8 c d 2 Printing t... View the full answer
Related Book For
Applied Regression Analysis and Other Multivariable Methods
ISBN: 978-1285051086
5th edition
Authors: David G. Kleinbaum, Lawrence L. Kupper, Azhar Nizam, Eli S. Rosenberg
Posted Date:
Students also viewed these programming questions
-
"The influence of employee motivation and engagement on organizational performance" Construct a literature review for above research topic Search for relevant literature. Evaluate sources. Identify...
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Assume that you have just been hired as business manager of Campus Deli (CD), which is located adjacent to the campus. Sales were $1,100,000 last year, variable costs were 60% of sales, and fixed...
-
QUESTION 17 The moment of a force about a pivot point is; a. The force multiplied by the perpendicular distance fro the pivot point to the direction of the force b. the distance from the pivot to the...
-
Water leaked from a tank at a rate of r(t) liters per hour, where the graph of is as shown. Use Simpsons Rule to estimate the total amount of water that leaked out during the first six hours. 2 4
-
Many businesses seek to maximize profits and shareholder's wealth at the expense of other stakeholders (customers, employees ..) and the environment. The concept of corporatesocial responsibility...
-
Define requirements.
-
Mark Decker has identified four stocks for his portfolio, and he wants to determine the percentage of his total available funds he should invest in each stock. The alternative stocks include an...
-
In your opinion, how does financial aid contribute to student success in the for-profit and not-for-profit institutions? Is there any value in viewing the higher education industry from a business...
-
Surkis Company acquires equipment at a cost of $42,000 on January 3, 2017. Management estimates the equipment will have a residual value of $6,000 at the end of its four-year useful life. Assume the...
-
What is Cash Short and Over? Explain.
-
A serious challenge in successfully implementing strategy across borders is corruption. Corruption is complex and takes on many forms. In your groups, discuss: What is corruption? What are its...
-
Search the Internet and find examples of three new sports products recently introduced in the marketplace.
-
Find three Internet sites of professional athletes in any sport. In what stage of the product life cycle are these athletes? Support with evidence found on the Internet.
-
Find any advertisement for a sports product. Then describe and explain each of the elements in the communications process for that ad. Do the same (i.e., explain the communications process) for the...
-
Evaluate the promotional mix used for the marketing of any intercollegiate womens sport at your university. Do you believe the proper blend of promotional tools are being used? What could be done to...
-
Evaluate the integral (by interpreting it as the area between two curves) +2-x|da
-
Discuss the information available from the following techniques in the analysis of inorganic pigments used in antique oil paintings: (i) Powder X-ray diffraction, (ii) Infrared and Raman...
-
Consider again the study described in the main body of this chapter concerning the effect of an air pollution episode on pulmonary function measurements (FEV1) taken on each of K= 40 school children...
-
A researcher was interested in determining risk factors for high blood pressure (hypertension) among women. Data from a sample group of 680 women were collected. The following table gives the...
-
A psychosociological questionnaire was administered to a random sample of 200 persons on an island in the South Pacific that has become increasingly westernized over the past 30 years. From the...
-
Compare different cooling schedule of simulated annealing.
-
Discuss the perturbation mechanism of simulated annealing.
-
What are the pros and cons of GA and SA? Can we conceive of a framework that combines the best of both worlds?
Study smarter with the SolutionInn App