Sum or Product

Programming Questions

← Back

Sum or Product

You are given a function sum_and_product, with integers a, b, and boolean multiply. You are to do the following:

If multiply is True, then multiply the numbers together. Otherwise, add the numbers together.

Input:

  • a: An integer
  • b: An integer
  • multiply: A boolean

Example 1:

sum_or_product(5, 7, False) = 12

Example 2:

sum_or_product(5, 7, True) = 35

Not Completed

Completed!

sum_or_product.py

Tests - to submit your code!

symbol symbol

Efficiency

symbol symbol

Test Case 1

symbol symbol

Test Case 2

symbol symbol

Test Case 3

symbol symbol

Test Case 4

symbol symbol

Test Case 5

symbol symbol

Test Case 6

symbol symbol

Test Case 7

symbol symbol

Test Case 8

symbol symbol

Test Case 9

symbol symbol

Test Case 10

symbol symbol

Test Case 11

symbol symbol

Test Case 12

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

Join our Newsletter and Recieve the Latest Updates!

Main Links

Compete Trade Courses Assessments Interview Prep Contact Us

Social Media

Facebook Instagram YouTube

Legal

Terms and Conditions

Talent Acquisition

We help firms recruit dedicated, passionate visionaries in mathematics and innovation for leading technology and trading roles. If your company is looking to attract top-tier talent in these fields, we can connect you with individuals who excel in driving technological and mathematical advancements. For more information, contact us here.

© 2024 EverythingQuant. All Rights Reserved.