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

Python

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.

Python

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

Given that add, a function that expects two int parameters and returns their sum, and given that two variables , euro_sales and asia_sales, have already been defined.

Python

LANGUAGE:  PYTHON CHALLENGE: Given that add, a function that expects two int parameters and returns their sum, and given that two variables , euro_sales and asia_sales, have already been defined. Write a statement that calls add to compute the sum of euro_sales and asia_sales and that associates this value with a variable named eurasia_sales.

Read More

Given print_larger, a function that expects two parameters and returns no value and given two variables, sales1 and sales2, that have already been defined, write a statement that calls print_larger, passing it sales1 and sales2.

Python

LANGUAGE:  PYTHON CHALLENGE: Given print_larger, a function that expects two parameters and returns no value and given two variables, sales1 and sales2, that have already been defined, write a statement that calls print_larger, passing it sales1 and sales2.

Read More