Write a Python function that takes two parameters which are strings, consisting only of digits 0 through 10 as characters. t1 and t2 are not empty. use the int () conversion. If the two integers represented by these two strings are both even or both odd, then the result of the function is the sum of these two integers. Otherwise, the result of the function is the product of these two integers. The function must return (return) this result (which will therefore also be of type integer).

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 22PE
icon
Related questions
Question
Write a Python function that takes two parameters which are strings,
consisting only of digits 0 through 10 as characters. t1 and t2 are not
empty. use the int () conversion. If the two integers represented by
these two strings are both even or both odd, then the result of the
function is the sum of these two integers. Otherwise, the result of the
function
is the product of these two integers. The function must return (return)
this result (which will therefore also be of type integer).
Transcribed Image Text:Write a Python function that takes two parameters which are strings, consisting only of digits 0 through 10 as characters. t1 and t2 are not empty. use the int () conversion. If the two integers represented by these two strings are both even or both odd, then the result of the function is the sum of these two integers. Otherwise, the result of the function is the product of these two integers. The function must return (return) this result (which will therefore also be of type integer).
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr