Explanation of Solution
a)
Given statement: range(5)
#Define the main function
def main():
#Loop
for i in range(5):
#print the values
�...
Explanation of Solution
b)
Given statement: range(3, 10)
Program:
#Define the main function
def main():
#Loop
for i in range(3, 10):
#print the values
print(i)
#Call the ma...
Explanation of Solution
c)
Given statement: range(4, 13, 3)
Program:
#Define the main function
def main():
#Loop
for i in range(4, 13, 3):
#print the values
print(i)
#Call the main function
main()
Explanation...
Explanation of Solution
d)
Given statement: range(15, 5, -2)
Program:
#Define the main function
def main():
#Loop
for i in range(15, 5, -2):
#print the values
print(i)
#Call the main function
main()
Explanation:
Explanation of Solution
e)
Given statement: range(5, 3)
Program:
#Define the main function
def main():
#Loop
for i in range(5, 3):
#print the values
print(i)
#Call the main function
main()
Trending nowThis is a popular solution!
Chapter 3 Solutions
Python Programming: An Introduction to Computer Science, 3rd Ed.
- 1. Factorial function to calculate factorial of a number which is given input to function. 2. Print factorial of integers from 1 to 10 using factorial function.arrow_forward(Numerical) Using the srand() and rand() C++ library functions, fill an array of 1000 floating-point numbers with random numbers that have been scaled to the range 1 to 100. Then determine and display the number of random numbers having values between 1 and 50 and the number having values greater than 50. What do you expect the output counts to be?arrow_forwardWhat is the numeric value of each of the following expressions, as evaluated by the C# programming language? 2+5*3 9/4+10 10/3 2110 (51)*3 37/5 648 5+2*43*4 3*(2+5)/5 2852 19/2/2 28/(2+4)arrow_forward
- (Civil eng.) Write a C++ program to calculate and display the maximum bending moment, M, of a beam that’s supported on both ends (see Figure 3.8). The formula is M=XW(LX)/L, where X is the distance from the end of the beam that a weight, W, is placed, and L is the beam’s length. You program should produce this display: The maximum bending moment is xxxx.xxxx The xxxx.xxxx denotes placing the calculated value in a field wide enough for four places to the right and left of the decimal point. For your program, assign the values1.2,1.3,and11.2toX,W,andL.arrow_forward(Statistical) In many statistical analysis programs, data values considerably outside the range of the majority of values are simply dropped from consideration. Using this information, write a C++ program that accepts up to 10 floating-point values from a user and determines and displays the average and standard deviation of the input values. All values more than four standard deviations away from the computed average are to be displayed and dropped from any further calculation, and a new average and standard deviation should be computed and displayed.arrow_forwardQ: draw FA for the following regular Expression. 2. (b + ab*a)* ab*arrow_forward
- This code segment find the Perimeter and area of any triangular using the equation formula as shown below. The values of a, b, and c are entered into separate text boxes and display Perimeter and area in separate text boxes. P=a+b+c: s= (a+b+c)/2 AR-√√s*(s-a)*(s-b)*(s-c) 1-.......... 2-..... 3-...... P=a+b+c s=(a+b+c)/2 AR-Sqr(s* (s-a) * (s-b) * (s-c)) 4-.. 5-.. * 5 points 1-a =inputbox("a") 2-b =inputbox("b") 3-c =inputbox("c") 4- T4.Text = P 5-T5.Text = AR 1-a = CInt(T1.Text) 2-b = Cint(T2.Text) 3-c = CInt(T3.Text) 4- P=T4. Text 5-AR=T5.Text 1- CInt(T1.Text) =a 2- Cint(T2.Text)=b 3-Cint(T3.Text)=c 4-T4.Text = P 5-T5.Text = AR 1-a = T1.Text 2-b = T2.Text 3-c = T3. Text 4-T4.Text = P 5-T5.Text = AR 1-a Cint(T1.Text) 2-b = 09:36arrow_forwardx=0:pi/10:2*pi; y1=sin (x); xlabel ('x (rad)') ylabel ('sin (x)') title ('sine function') * plot(x,y1,'r:+') ste function 06 04 02 02 06 08 -1 Option 1 O ste function 08 06 02 02 04 06arrow_forwardQ/use visual Basic to write a Program to compute the Functions: Natural logarithms. integer values and absolute Value for x value x = y² - 3y + 2arrow_forward
- This procedure is called as interpolation because it entails guessing a function's value at a location outside the data's range.arrow_forwardWrite the pseudocode given the following expressions, re-write, and add parentheses based on the sequence of how they will be evaluated. You have to add static value for each of the variables. 1) a / b ^ c ^ d – e + f – g * h + I 2) 3 * 10 *2 / 15 – 2 + 4 ^ 2 ^ 2 3) r ^ s * t / u – v + w ^ x – y+arrow_forwardAn ISBN-10 (International Standard Book Number) consists of 10 digits: The last digit, is a checksum, which is calculated from the other nine digits using the following formula: (d1 x 1 + d2 x 2 + d3 x 3 + d4 x 4 + d5 x 5 + d6 x 6 + d7 x 7 + d8 x 8 + d9 x 9) % 11) If the checksum is 10, the last digit is denoted as X, according to the ISBN convention. Write a program that prompts the user to enter the first 9 digits as a string and displays the 10-digit ISBN (including leading zeros). Your program should read the input as a string.arrow_forward
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr