For each expression below, indicate it's value. Be sure to list appropriate type (eg, 9.0 for a double, string in quotes) 1) 8*3.0 + 17/3 2) 11%3 +1/5 + 0.5*4 3) !(20<3)&&(7<9)||0.03>0.2 4) "1"+2+3+"4"+5*6+"7" 5) 7/2!=123/12%7 6) 4+4+"4+4"+4+4
Q: setprecision (n) : when used in conjunction with fixed, set the number of digits after the decimal…
A: Below is the code and sample output:
Q: Draw a bar chart of 5 values entered by the user (>=0), where the y-axis is along the rows and the…
A: PROGRAM CODE:…
Q: Evaluate the following expressions. (2) a. 4 * 7 == 74 / 3 b. 4 + 7 / 2 = 8 - 6.2 * 1.5
A: Note - As per the guidelines, we are only allowed to answer 1 question and 3 sub parts.
Q: Write the result of the following code: No need to attach your full code or an image of the output,…
A: As per our guidelines we are supposed to answer only 3 sub parts of a question but each sub part of…
Q: > Example: Rewrite the previous code by using nested if condition. grade (x) := if x 2 60 out "you…
A: Here we are taking marks as an input and as a output we get grade of a student if student is less…
Q: 1.Given the following declarations, evaluate the expression below and assign true or false value for…
A: In step 2 I am giving the Source code in C language, as there is no particular language mentioned…
Q: A factorial of N is defined as 1 if N is O or 1, and 1*2**N if N is a non-negative integer. Write a…
A: note:- only one program will be solved if they are not linked . Also mention programming language…
Q: int max3(int x,int y,int z){ if(xy) if(x>z) return x; else return z; else if(y>z) return y; else…
A: GIVEN:
Q: Input a number value for LEFT, RIGHT and X. If LEFT is greater than RIGHT, display the first ten…
A: Find the required code in java given as below and output :
Q: Sometimes a company will use telephone numbers like 757-GET-FOOD to make the numbers easier to…
A: A = B = C = 2D = E = F = 3G = H = I = 4 J = K = L = 5 M = N = O = 6 P = Q = R = S = 7 T = U = V = 8…
Q: Which is the correct statement in the following? O if (x = 0) cout << "x is zero"; %3D if (x < y <…
A: Here, I have to choose an option for the above question.
Q: Write a number activity and then circle the circle or square. The input will be in the form (letter…
A: Algorithm - Create a new function with name perimeter with two arguemnt. Now use the below logic…
Q: 1- Question We would like to create a pattern where in each line we will have 0, 4, 8, 12 stars;…
A: According to the Question below the Complete Solution:
Q: following code: scores = 1 while scores < 20: scores = scores + 2 print(scores) Once the code is…
A: // highScores array declaration int[] highScores = { 10, 9, 8, 8}; // use a variable for the index…
Q: Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and…
A: Given that We have to find the maxMiles and minMiles values for the given program. #include…
Q: The Significance (S-value) of an integer number is the number of the digits that are composing the…
A: PROGRAM EXPLANATION: - The program comprise of multiple parts. The input is taken from user for the…
Q: Assume there is a variable, h that has already been assigned a positive integer value. Write the…
A: In step 2, you will get python code. In step 3, you can see the sample output.
Q: ?What will the following code do ; j=0 ; 1=5 (while (j<0 ; j=j-1 ; i=i+5 ; j=1 end اخترأحد الخيارات…
A: Please find the answer below step.
Q: Given a positive integer n, the following rules will always create a sequence that ends with 1,…
A: 1)Read the n value using int(input()) function 2)print n value 3)repeat while until n!=1 4)…
Q: baython you have the following code, .choose the correct answer x = [3.0, 5.0, -1.0, 0.0, 3.14] n =…
A: x and n both are variables where x is storing the reference of the list and n is storing the length…
Q: In the following code snippet, where comments indicate line numbers: uint64_t x = 2; uint64_t y = 5;…
A:
Q: In Python User input must be 8 characters or shorter, and must be printed out in all capitals.…
A: Program outline: Ask user for input Find length of string If the user uses less than 8 characters:…
Q: Given a positive integer n, the following rules will always create a sequence that ends with 1,…
A: As per the requirement program is developed. Note: Here in the question programming language is not…
Q: Let A = {4, {4, 5}, {5},Ø}. ANswer each of the following questions. 1) |A| = 5 2) Which of the…
A: Here in this question we have given a set A and based on this we have asked to answer true or false…
Q: Given a positive integer n, the following rules will always create a sequence that ends with 1,…
A: Algorithm: 1. input a number 2.Condition checking that is number must be greater than 1 3.number is…
Q: Q3\A) Evaluate the following expressions with explanation for each one: (5 only) int x= 10, y=8, z;…
A: Note : Since the question is multipart we are advised to only first three parts. Kindly post other…
Q: PYTHON PROGRAMMING !)Write a program to display all the numbers which are divisible by 13 but…
A: As per guidelines we are supposed to answer only one question. Kindly repost other questions as a…
Q: int a = 5, b =10; boolean c = (b - 2) < (a + 5); What is the value of c in the above code ? a. True…
A: Here b-2 = 10 - 2 = 8 a+5 = 5 + 5 = 10 b-2 is less than a+5 So the value of c is True.
Q: Task 03 Write a program which stores a large number in AX, stores another smaller number in BX. Now…
A: the program is given below:-
Q: Answer TRUE if the expression will return non-zero and FALSE if not. Evaluate using the following…
A: Answer TRUE if the expression will return non-zero and FALSE if not. Evaluate using the following…
Q: complete magic Square #include using namespace std; /*int f( int x, int y, int* p, int* q ) { if…
A: It is defined as a direct descendant of C programming language with additional features such as type…
Q: Declare fvar number :=null; svar number :=5; Begin goto > if fvar is null then >…
A: Declare fvar number :=null;//fvar=null svar number :=5;//svar=5 Begin goto…
Q: Write Psuedo-code of an algorithm that will repeatedly ask the user to enter a number 10 times. If…
A: Psuedo code is step by step written outline that can be easily translated into the program.
Q: Given a positive integer n, the following rules will always create a sequence that ends with 1,…
A: for whitespaces of \t use end=‘\t’ , but if you don’t want these whitespaces , you can use end=‘ ’
Q: 1. Starting with the leftmost digit, double it and then double every other digit after it. However,…
A: code is given below
Q: : Find the results if code below is ;int a = 3 %3! ;int b = 8 ;int x1,x2 ; x1= ((a ; x2= ((a 0) &&…
A:
Q: Finding Errors. Identifying the line/s containing errors that can cause the program not to run.…
A: The solution to the given problem is below.
Q: In Ruritania, fractional numbers are rounded up to the next integer if the fractional part is at…
A: Note: For the fractional numbers, the program which is given as a screenshot in the question, is…
Q: 1- Define a variable to hold student name, ex: "john smith" 2- For each letter in your name print…
A: CODE : public class Count { public static void main(String[] args) {…
Q: Write statements that assign random integers to the variable n in the following ranges: a) 1 Sn S2…
A: Statements that assign random integers to the variable n in the given ranges: //(a) 1 ≤n ≤2 n = 1 +…
Q: Suppose you want to deposit a certain amount of money into a savings account and then leave it alone…
A: Note: Programming language is missing in the question. So we will answer this program in C++…
Q: Q3\A) Evaluate the following expressions with explanation for each one: (5 only) int x= 10, y=8, z;…
A: && returns true only when both expressions before and after && is true otherwise it…
Q: Example : Ask a teacher to enter a set of letter grades(5 letters), then display a summery of the…
A: Q: Print number of students who received each grade.
Q: Assume you are working as a developer in a bank, and you have been asked to develop a program to…
A: A flowchart is a diagrammatic representation of the flow of an algorithm. It consists of various…
Q: What is the resulting value of the following expression? 15 / 10 * 10 + 8.0 O 23 18 Error O 8.0 O…
A: In java, Arithmetic calculation is done by the Java Precedence Rule Java Precedence Rule In this…
Q: in the United States, telephone numbers consist of a three digit area code followed by a seven digit…
A: Area codes are in 3 digits.Given that first digit cannot be zero.First digit can't be 0 it can any…
Q: Variables n, n1 and n2 are integer variables, and n1 n1 && n= n1 && n n1 and n= n1 ||n <= n2)
A: As per our guidelines we are supposed to answer only one question. Kindly repost other questions as…
Q: 21. In the following code (number added), which will be the last line executés successi (1) astr -…
A: Correct Answer is a 1. After this second line will throw an error. Let us understand why
Q: 2.15 LAB: Musical note frequencies On a piano, a key has a frequency, say f0. Each higher key…
A: import math # reading key frequency from usr inputFrequency = float(input()) # calculating value…
Q: Question: 2 Write a program using nested loop structures that displays the following ou tput. 00 01…
A: #Logic to develop code Let we have two variable i and j. variable i will print rows and variable j…
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
Step by step
Solved in 2 steps with 1 images
- Python Language Useful websites: : http://en.wikipedia.org/wiki/Radix http://www.purplemath.com/modules/numbbase.htm Special Rules: Use only Boolean/math expressions and conditional statements (if-statements). Do not use built-in functions for converting integers into a string representation. Here to start with: kthDigit(x: int, b: int, k: int) -> int .........NumberFun.py # using multiple functions. # copy/paste this program to run it first, you are supposed to use Google Chrome as Internet Browser for this course. # 1. calculate sum of the first n natural odd numbers, e.g.:1,3,5,7,9... def totalN(n): totalN = 0 for i in range(1,2*n+1,2): totalN = totalN + i return totalN # 2. calculate sum of the square of the first m natural odd numbers, e.g.:1,9,25,49,81... ### After you define/write/complete the function totalMSquare(m), remove the # sign as below to ENABLE next line of code #def totalMSquare(m):### YOUR TURN TO DEFINE/WRITE/COMPLETE function totalMSquare(m) as below, based on totalN(n) Please based on the first function, add more statements for the second function. You can copy/paste the sample program to run and see how it works to make sense first. 2. Don't delete the statements/codes/comments for this program, but just add more statements for the second function. (if deleted, points will be deducted.)Discrete Mathematics: Assignment details: Replace all the 0 (Zero) digits in your ID by 4. Example: If your ID is 38104680, it becomes 38144684 Take the first 6 digits and substitute them in this expression (( A + B) / C) * ((D-E)/F)-2) according to the following table; Letter Replace by Digit Example Digit A 1st 3 B 2nd 8 C 3rd 1 D 4th 4 E 5th 4 F 6th 6 After substitution your expression will be similar to this (( 3 + 8) / 1) * ((4-4)/6)-2). Draw a rooted tree that represents your expression. What is the prefix form of this expression. 3.What is the value of the prefix expression obtained in step 2 above?
- # NumberFun.py # using multiple functions. # copy/paste this program to run it first, you are supposed to use Google Chrome as Internet Browser for this course. # 1. calculate sum of the first n natural numbers, e.g.:1,2,3,... def sumN(n): sumN = 0 for i in range(1,n+1): sumN = sumN + i return sumN # 2. calculate sum of the square of the first m natural numbers, e.g.:1,4,9,... ### After you define/write/complete the function sumMSquare(m), remove the # sign as below to ENABLE next line of code ####def sumMSquare(m):### YOUR TURN TO DEFINE/WRITE/COMPLETE function sumMSquare(m) as below, based on sumN(n) # 3. call two functions defined previously within main() function def main(): print("This program computes the total and total of squares of the first") print("N/M natural numbers.\n") n,m = input("Please enter a value for N and M: ").split(",") print("The total of the first", n, "natural numbers is", sumN(int(n)))### After you define/write/complete the function sumMSquare(m), remove…def f(x: float) -> int: return int(x) def g(x: str) -> float: return float(x) y = f(g("3.14")) Select all of the following statements that are true: y's inferred data type is float O y 's inferred data type is str O y's inferred data type is int There is a type error in this program None of the above are trueProblem Description The hailstone sequence is defined as the integer sequence that results from manipulating a positive integer value n as follows: If n is even, divide it by 2 (using floor division) • If n is odd, multiply it by 3 and then add 1 Repeat this process until you reach 1. For example, starting with n = 5, we get the sequence 5, 16, 8, 4, 2, 1. If n is 6, we get the sequence 6, 3, 10, 5, 16, 8, 4, 2, 1. If n is 7, we get 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1. If n is 8, we get the sequence 8, 4, 2, 1. As far as anyone can tell, this process will eventually reach 1 for any starting value, although mathematicians have been unable to formally prove this property as of yet. a. Write a Python function named hail () that takes a single integer argument. hail() should print out the sequence of numbers generated by applying the process above to the function parameter. This function does not return any value.
- PYTHON HOMEWORK QUESTION def area(side1, side2): return side1 * side2 s1 = 12s2 = 6 Select all statements that correctly call the area function. A. answer = area(s1,s2)B. print(f'The area is {area(s1,s2)}')C. area(s1,s2)D. result = area(side1,side2)Python: numpy def serial_numbers(num_players):"""QUESTION 2- You are going to assign each player a serial number in the game.- In order to make the players feel that the game is very popular with a large player base,you don't want the serial numbers to be consecutive. - Instead, the serial numbers of the players must be equally spaced, starting from 1 and going all the way up to 100 (inclusive).- Given the number of players in the system, return a 1D numpy array of the serial numbers for the players.- THIS MUST BE DONE IN ONE LINEArgs:num_players (int)Returns:np.array>> serial_numbers(10)array([1. 12. 23. 34. 45. 56. 67. 78. 89. 100.])>> serial_numbers(12)array([1. 10. 19. 28. 37. 46. 55. 64. 73. 82. 91. 100.])""" # print(serial_numbers(10)) # print(serial_numbers(12))Program - python A nutritionist who works for a fitness club helps members by evaluating their diets. As part of her evaluation, she asks members for the number of fat grams and carbohydrate grams that they consumed in a day. Then, she calculates the number of calories that result from the fat, using the following formula: calories from fat = fat grams x 9. Next, she calculates the number of calories that result from the carbohydrates, using the following formula: calories from carbs = carb grams x 4. Write a program that will make these calculations. Your program should use two separate functions to calculate fat and carb calories. Write a 3rd function that is called from main to capture user input and call the others.
- # NumberFun.py # using multiple functions. # copy/paste this program to run it first, you are supposed to use Google Chrome as Internet Browser for this course. # 1. calculate sum of the first n natural numbers, e.g.:1,2,3,... def totalN(n): totalN = 0 for i in range(1,n+1): totalN = totalN + i return totalN # 2. calculate sum of the cube of the first m natural numbers, e.g.:1,8,27,... ### After you define/write/complete the function totalMCube(m), remove the # sign as below to ENABLE next line of code ###def totalMCube(m):### YOUR TURN TO DEFINE/WRITE/COMPLETE function totalMCube(m) as below, based on totalN(n) # 3. call two functions defined previously within main() function def main(): print("This program computes the total and total of cubes of the first") print("N/M natural numbers.\n") n,m = input("Please enter a value for N and M: ").split(",") print("The total of the first", n, "natural numbers is", totalN(int(n)))### After you define/write/complete the function totalMCube(m),…Python question Application: Python Fragment Formulation (Q1 – Q4) In this group of questions you are asked to produce short pieces of Python code. When you are asked to "write a Python expression" to complete a task, you can either give the expression in one line or break down the task into several lines. The last expression you write must represent the required task. Question 1 (Reduce parentheses) Give an equivalent version of this expression by removing as many redundant parentheses as possible, without expanding the brackets or simplifying. (x**(2**y))+(y*((z+x)**3)) Question 2 (Translate arithmetic concept into Python) You are given a list of numbers, named numbers, containing 3 integers. Write a python expression (one line) that evaluates to True if and only if the product of any two numbers in the given list is greater than the sum of all three numbers. Note: the product of two numbers, x and y is x*y. Question 3 (List/table access) You are given a table,…(Statistics) This is the formula for the standard normal deviate, z, used in statistical applications: z=(X)/ X is a single value. refers to an average value. refers to a standard deviation. Using this formula, you need to write a program that calculates and displays the value of the standard normal deviate when X=85.3,=80,and=4. a. For this programming problem, how many outputs are required? b. How many inputs does this problem have? c. Determine a formula for converting input items into output items. d. Test the formula written for Exercise 7c, using the data given in the problem.