Category: Web Development

Write an expression (not a statement!) whose value is the largest of population1, population2, population3, and population4 by calling max2.

Write an expression (not a statement!) whose value is the largest of population1, population2, population3, and population4 by calling max2.

LANGUAGE:  PYTHON CHALLENGE: assume that max2 is a function that expects two int parameters and returns the value of the larger one. Also assume that four variables , population1, population2, population3, and population4 have already been defined and associated with int values. Write an expression (not a statement!) whose value is the largest of population1, […]

Read More

Write an expression (not a statement!) whose value is the larger of population1 and population2 by calling max.

Write an expression (not a statement!) whose value is the larger of population1 and population2 by calling max.

LANGUAGE:  PYTHON CHALLENGE: max is a function that expects two int parameters and returns the value of the larger one. Two variables , population1 and population2, have already been defined and associated with int values. Write an expression (not a statement!) whose value is the larger of population1 and population2 by calling max.

Read More

[Functions >> functions and if statements] Write the definition of a function powerTo which receives two parameters, a double and an integer.

[Functions >> functions and if statements] Write the definition of a function powerTo which receives two parameters, a double and an integer.

LANGUAGE:  PYTHON CHALLENGE: [Functions >> functions and if statements] Write the definition of a function powerTo which receives two parameters, a double and an integer. If the second parameter is positive, the function returns the value of the first parameter raised to the power of the second. Otherwise, the function returns 0.

Read More

Assume the availability of a function is_prime. Assume a variable n has been associated with positive integer.

Assume the availability of a function is_prime.  Assume a variable n has been associated with positive integer.

LANGUAGE:  PYTHON CHALLENGE: Assume the availability of a function is_prime. Assume a variable n has been associated with positive integer. Write the statements needed to find out how many prime numbers (starting with 2 and going in increasing order with successively higher primes [2,3,5,7,11,13,…]) can be added before exceeding n. Associate this number with the […]

Read More