def find_even_odd(num):
# Condition to check if the number is even by using the modulus operator
if (num%2) == 0:
print(num,"is an EVEN number")
else:
print(num,"is an ODD number")
The function can be checked by the following lines:
find_even_odd(6)
find_even_odd(11)
Here, the modulus operator is used to check if the number is ODD or EVEN.
python programming X Canvas 4 → XCO Question 26 10 pts (SHORT ANSWER) Define a function...
This exercise is also from C++ How do I even figure this out? please help me solve so I can get the answer correctly! Question 28 10 pts (SHORT ANSWER) Define a function named findEvenOrOdd that has 1 int parameter: num. When the function is called, it should use an if/else statement -OR- conditional expression to determine whether the variable num is an even or odd number and display appropriate message as follows: • If the value in num is...
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...
python Canvas 10 pts Question 26 Assume a variable score that has already been initialized, write one if/elif/else statement that will: • Output the message "Test was not taken if the score variable is equal to 0. • Output the error message "Error: Score is not valid" if the value stored in the score variable is outside the range of 0-100 (i.e., not in between 0 and 100; less than 0 or greater than 100). . If the value stored...
python programming Question 29 10 pts (SHORT ANSWER) Define a function named display_pattern that is a void function with no parameters. When the function is called, it should use a nested loop to to display the symbol # in 2 rows and 3 columns as follows: ### ### BI V A - A - I E33 x x, E V GT 12pt Paragraph
Functions can return a string, not just an int or a float. Write a function called everOrOdd which takes an integer parameter and returns either "Even" or "Odd" based on the value passed. In main, prompt the user for a number, called num, then pass num to evenOrOdd and display the returned value on the screen. Keep doing this until the user enters a zero. Use the following run as an example: Enter a number: 11 Odd Enter a number:...
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
In this exercise, you will create a script called if_then_else.sh that uses an IF THEN ELSE statement. The if_then_else.sh script will Use one command line argument, which will be a number between 1 and 10 Assign the value of the first argument to a local variable called NUM. HINT: Look at line 5 in the example screenshot for arguments.sh Use one IF THEN ELSE statement to compare the value of NUM If the number is less than 5, display the...
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...
please use python Question 4: Define a function named q40 that accepts a string as a parameter. After verifying that the string includes only includes numeric digits, count the number of even (E) and odd (O) digits. Finally, create a new string made up of these values and their sum. Repeat this process until your end result is a string containing 123 For example, '15327' contains 1 even digit (E-1), 4 odd digits(O-4) and the sum of these is 5...
programming language: C++ *Include Line Documenatations* Overview For this assignment, write a program that will simulate a game of Roulette. Roulette is a casino game of chance where a player may choose to place bets on either a single number, the colors red or black, or whether a number is even or odd. (Note: bets may also be placed on a range of numbers, but we will not cover that situation in this program.) A winning number and color is...