===========
CODE
===========
# Below code is written in python 3,
# for successful output please execute in python3
# display_pattern function creation
def display_pattern():
# for loop for 2 rows
for x in range(2):
# nested for loop for 3 columns
for y in range(3):
# printing * to console with same line as end as empty
print("*",
end="")
# new line for console output
print()
if __name__== '__main__':
# calling the display_pattern method
display_pattern()
===================
OUTPUT
===================
python programming Question 29 10 pts (SHORT ANSWER) Define a function named display_pattern that is a...
python programming X Canvas 4 → XCO Question 26 10 pts (SHORT ANSWER) Define a function named find_even_odd that has 1 parameter: num. When the function is called, it should use an if/else statement to determine whether the variable num is an even or odd number and display appropriate message as follows: • If the value in num is an even number, the progr will output the message: "XX is an EVEN number", where XX is the value in the...
python programming Canvas 4 → XC Question 27 10 pts (SHORT ANSWER) Using a for loop, display horizontally the numbers in the range 0-25 (both numbers inclusive) in increment of 5 as follows: 0 5 10 15 20 25 BI AA- IX E31 x , DEE - 2 VTT12pt Paragraph O words
python programming → X CIO CIUSCUTETTE TUVOITTEESITTEETTICLE Question 30 10 pts (SHORT ANSWER) Assume the following: • temps is a list of SIZE elements that has been assigned values • limit is a variable that has been assigned a value Write code to do the following: • Create a variable named count to keep track of the number of elements in temps list that are lesser than limit Using a loop, count the number of elements in the temps list...
python programming Canvas → XCO Question 28 10 pts (SHORT ANSWER) Write Python statements to do the following (number your answers); 1. Create a constant PI and assign it 3.1415 2. Calculate the volume of the cone and store it in the variable volume . Given the formula to compute the volume of a cone is: II-> (5) • Assume: the variables r and h are already assigned with values 3. Display the computed volume on the console as follows...
This is a C++ statement, how do I solve this problem using the void function? Question 29 10 pts (SHORT ANSWER) Define a void function named swap2 Nums that accepts 2 integer reference parameters: num1 and num2. The function should then swap the two numbers. Use additional variable(s) as necessary. BIVA-AIK EE311xx, V TT 12pt Paragraph O words
Answer based on python (5 Pts.) What keyword is used to define a function in Python? (5 Pts.) Where is the input/argument of a function placed when calling a function? (5 Pts.) Functions in Python can take 2 types of arguments: “*args” and “**kwargs”, what kind of code structures in Python can be inputted to a function as “**kwargs”?, circle one of the following choices: (Lists, Tuples, Dictionaries, Nested Lists) (5 Pts.) Functions in Python are capable of accomplishing 2...
For this problem, assume salesperson data are stored in a database table named staff. Also assume the columns in the table are named name, carsSold, and totalSales Write a Python function named getSalesSortedByNames. Your function will have 2 parameters. The first parameter is a database cursor and the second parameter is a float. Your function should start by retrieving those rows in the staff table whose totalsales field is equal to the second parameter. (The next paragraph shows the Python...
in python result inト 9c. (5 pts) Write a function named between that is defined with two parameters. It returns a reference to a tion that has one parameter, which returns whether or not its one parameter is between (inclusive) the two arguments supplied when between is called. For example x between (18,22) and the call x(29) returns True. def between(lower, upper): result inト 9c. (5 pts) Write a function named between that is defined with two parameters. It returns...
Using Python Programming Language: 4. Implement the following function in the PyDev module functions.py and test it from a PyDev module named t04.py: def print_matrix_char(matrix): Prints the contents of a 2D list of strings in a formatted table. Prints row and column headings. Use: print_matrix_char (matrix) Parameters: matrix - a 2D list of strings (2D list) Returns: None. Sample testing: Number of rows: 3 Number of columns: 4 0 1 2 3 i 0 с u r 1 с у...
in c++ (SHORT ANSWER) Define a function named halfNum that has one integer paramétel half of the number For example: If we called the function halfNum(1) then, the function should return 0.5