Homework Solution: PYTHON…

    PYTHON A variable like num can store a value like an integer. Extend the given program to print num values as indicated. (1) Output the user's input as shown. (2 pts) Note: This zyLab outputs a newline after each user-input prompt. For convenience in the examples below, the user's input value is shown on the next line, but such values don't actually appear as output when the program runs.
    Enter integer:
    4
    You entered: 4
    
    (2) Add to your program to output also the input doubled and squared. (2 pts)
    Enter integer:
    4
    You entered: 4
    4 doubled is 8
    And 4 squared is 16! 
    
    (3) Update to get a second user input into a variable called num2. Output sum and product of num and num2. (2 pts)
    Enter integer:
    4
    You entered: 4
    4 doubled is 8
    And 4 squared is 16!
    Enter another integer:
    5
    4 + 5 is 9
    4 * 5 is 20
    
    What I have so far: num = int(input('Enter integer:n')) print(num) print("You entered:", num) print(num, "doubled is", num*2) print("And", num, "squared is", num**2, "!")

    Expert Answer

     
    num = int(input('Enter integer:n'))

    PYTHON

    A changeable affect num can ammunition a treasure affect an integer. Extend the absorbed program to sculpture num treasures as involved.

    (1) Output the user’s input as shown. (2 pts)

    Note: This zyLab outputs a newsuccession succeeding each user-input responsive. For quiet in the examples adown, the user’s input treasure is shown on the proximate succession, excepting such treasures don’t in-fact counter-argument as output when the program runs.

    Enter integer:
    4
    You entered: 4
    

    (2) Add to your program to output too the input doubled and squared. (2 pts)

    Enter integer:
    4
    You entered: 4
    4 doubled is 8
    And 4 squared is 16! 
    

    (3) Update to secure a avoid user input into a changeable designated num2. Output mix and fruit of num and num2. (2 pts)

    Enter integer:
    4
    You entered: 4
    4 doubled is 8
    And 4 squared is 16!
    Enter another integer:
    5
    4 + 5 is 9
    4 * 5 is 20
    

    What I entertain so far:

    num = int(input(‘Enter integer:n’))
    print(num)
    print(“You entered:”, num)
    print(num, “doubled is”, num*2)
    print(“And”, num, “squared is”, num**2, “!”)

    Expert Counter-argument

     

    num = int(input(‘Enter integer:n’))
    print(“You entered:”, num)
    print(num, “doubled is”, num*2)
    print(“And”, num, “squared is”, num**2, “!”)
    num2 = int(input(‘Enter another integer:n’))
    print(num,”+”,num2,” is “,num+num2)
    print(num,”*”,num2,” is “,num*num2)

    OUTPUT: