1. Using Python3, encode the following: a. Create a simple function that has a number as an input, prints twice that number, and has a return value of thrice the input. Input Assume the input are integers. Constraints Assume no invalid inputs are given. E.g. No text will be given as input Output Two integers will be the output, twice and thrice the input respectively. Sample: Input 100 Output 200 300 b. Create a function solving for one root of a quadratic equation. (Note: Let +/- be only plus sign) Input Format The inputs are three numbers corresponding to a, b, and c. x=-b+\b? –4ac 2a Constraints Use only 15 lines of code. You may assume that only valid combinations of a, b, and c will be inputted. E.g. No quadratic equations with imaginary roots. No ascii input, etc. Output Format The output will be the INTEGER root computed for.

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 12PE: Write a program that takes as input five numbers and outputs the mean (average) and standard...
icon
Related questions
Question
100%

Using Python3, encode the following:

Constraints: 15 lines only excluding comments and white space. 

1. Using Python3, encode the following:
a. Create a simple function that has a number as an input, prints twice that number, and has a return value
of thrice the input.
Input
Assume the input are integers.
Constraints
Assume no invalid inputs are given. E.g. No text will be given as input
Output
Two integers will be the output, twice and thrice the input respectively.
Sample:
Input
100
Output
200
300
b. Create a function solving for one root of a quadratic equation. (Note: Let +/- be only plus sign)
Input Format
The inputs are three numbers corresponding to a, b, and c.
-b+\b2–4ac
2a
Constraints
Use only 15 lines of code. You may assume that only valid combinations of a, b, and c will be
inputted. E.g. No quadratic equations with imaginary roots. No ascii input, etc.
Output Format
The output will be the INTEGER root computed for.
Transcribed Image Text:1. Using Python3, encode the following: a. Create a simple function that has a number as an input, prints twice that number, and has a return value of thrice the input. Input Assume the input are integers. Constraints Assume no invalid inputs are given. E.g. No text will be given as input Output Two integers will be the output, twice and thrice the input respectively. Sample: Input 100 Output 200 300 b. Create a function solving for one root of a quadratic equation. (Note: Let +/- be only plus sign) Input Format The inputs are three numbers corresponding to a, b, and c. -b+\b2–4ac 2a Constraints Use only 15 lines of code. You may assume that only valid combinations of a, b, and c will be inputted. E.g. No quadratic equations with imaginary roots. No ascii input, etc. Output Format The output will be the INTEGER root computed for.
Expert Solution
steps

Step by step

Solved in 2 steps

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