Question

In: Computer Science

Q4. Please write a function Calculate_integer_division(). Your function should accept two parameters num1 and num2 and...

Q4. Please write a function Calculate_integer_division(). Your function should accept two parameters num1 and num2 and return the result of integer division of num1 by num2. So if num1 is 9 and num2 is 2, the function should return 4. Call your function and print out the result.

Q5. Please print out the following with the help of a range() function: 200, 400, 600, 800

Q6. Please print 'Go.' if the traffic light is green, 'Wait.' if it's yellow and 'Stop!' if it's red. If it's none of the above, print 'Unknown color.'

Q7. Please print 'This is correct' if a real number is between 10.0 and 20.0 (including both 10 and 20).

Q8. Please print 'This is not correct' if a real number falls outside of the range described in the previous question.

Q9. Let's say that you decide to stop by the local cafe and purchase a cup of coffee. Please write a program that asks a user (you) for the price of this beverage. This program should then compute NY sales tax - 8.875% and display the amount of purchase, tax and total. Please use the format function to display cents.

Q10.Please write a program to produce the following output, please use as few print statements as possible:
A1
A2
A3
A4
B1
B2
B3
B4
C1
C2
C3
C4

Q11. Please print the following string:

Cat said 'meou'.

Q12. Assume that c is a string variable. Write an expression that checks if c is a space, a tab or a newline character.

Solutions

Expert Solution

4 ans:

5 ans:

6 ans:

7 ans:

8 ans:

9 ans:

10 ans:

11 ans:

12 ans:

#if you have any doubt or more information needed comment below.i will respond as possible as soon..thanks.


Related Solutions

Write a function that will accept two integer matrices C and D by reference parameters. The...
Write a function that will accept two integer matrices C and D by reference parameters. The function will compute the transpose of C and store it in D. For your information, the transpose of matrix C is D, where D[j][i] = C[i][j]. [7 marks] Explain the time complexity of this function inside of the function code as a comment. [3 marks] in C++
Write an overloaded function of function area with 3 (float) parameters. This function should calculate and...
Write an overloaded function of function area with 3 (float) parameters. This function should calculate and print out the product of the 3 parameters.
using python 1. #Write a function called multiply_file_by_index. This function #should take two parameters, both strings....
using python 1. #Write a function called multiply_file_by_index. This function #should take two parameters, both strings. The first string is #the filename of a file to which to write (output_file), and #the second string is the filename of a file from which to read #(input_file). # #In the input file, there will be an integer on every line. #To the output file, you should write the integer from the #original file multiplied by the line number on which it #appeared....
Write a function in R named counts. This function should take as parameters a numeric vector...
Write a function in R named counts. This function should take as parameters a numeric vector x and also a number indicating a number of bins n. The function will consider the range [min(x),max(x)], and then consider a parti- tion of this interval into n non-overlapping equally sized half open intervals: I1 = [min(x),b1),I2 = [b1,b − 2),...,In = (bn−1,max(x)]. Note that since the intervals are equally sized, the value of bi is constrained. The function will then return a...
Write a function using MATLAB that will accept a structure as an argument and return two...
Write a function using MATLAB that will accept a structure as an argument and return two cell arrays containing the names of the fields of that structure and the data types of each field. Be sure to check that the input argument is a structure, and generate an error message if it is not.
Sovle with python 3.8 please. 1, Write a function called same_without_ends that has two string parameters....
Sovle with python 3.8 please. 1, Write a function called same_without_ends that has two string parameters. It should return True if those strings are equal WITHOUT considering the characters on the ends (the beginning character and the last character). It should return False otherwise. For example, "last" and "bask" would be considered equal without considering the characters on the ends. Don't worry about the case where the strings have fewer than three characters. Your function MUST be called same_without_ends. You...
#Write a function called wish_list. wish_list should have #four parameters, in this order: # # -...
#Write a function called wish_list. wish_list should have #four parameters, in this order: # # - a list of strings, representing a list of items on a # wish list # - a string, representing a particular item # - a float, representing the cost of this item # - a float, representing your budget # #If the item is on the list and you can afford it (cost is #less than or equal to budget), return the string, #"You...
Requirements: C++ Array/File Functions Write a function named arrayToFile. The function should accept 3 arguments: The...
Requirements: C++ Array/File Functions Write a function named arrayToFile. The function should accept 3 arguments: The name of the file, a pointer to an array, and the size of the array. The function should open the specified file in binary mode, write the contents of the array to file, and then close the file. Write another function named fileToArray. This function should accept 3 arguments: the name of the file, a pointer, to an int array, and the size of...
#Write a function called solve_right_triangle. The function #solve_right_triangle should have three parameters: opposite, #adjacent, and use_degrees....
#Write a function called solve_right_triangle. The function #solve_right_triangle should have three parameters: opposite, #adjacent, and use_degrees. opposite and adjacent will be #floats, and use_degrees will be a boolean. use_degrees #should be a keyword parameter, and it should have a #default value of False. # #The function should return a tuple containing the #hypotenuse and angle of the right triangle (in that order). #If use_degrees is False, the angle should be in radians. #If use_degrees is True, the angle should be...
Write a Python function that takes two parameters: the first a list of strings and the...
Write a Python function that takes two parameters: the first a list of strings and the second a single string. The function should return True or False depending on whether the string is in the list or not. For example, if the list contains eggs, milk, bananas, and the second parameter is pumpkin, the function should return False. Thank you.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT