you are to write a function and for-loops that outputs the shape like the one below: Introduction to Programming, OUA, Australia
University | Open Universities Australia (OUA) |
Subject | Introduction to Programming |
Task 1:
Requirements
- You must keep the calculation as a single expression on a single line in your final solution.
- You must not rearrange or simplify the expression in any way.
- You should parentheses in code so that it is evaluated in the same way as the mathematical expression described above.
- You must not use any conpcets not covred yet
Example Runs
Run 1
Enter a value for x: 5
Enter a value for y: 3
Enter a value for z: 3
f = -7613.484692283496
Run 2
Enter a value for x: 1
Enter a value for y: 1
Enter a value for z: 1
f = 20.071067811865476
Run 3
Enter a value for x: 100
Enter a value for y: 1
Enter a value for z: 2
f = 47377.17423586197
Program:
x = int(input(“Enter a value for x: “))
y = int(input(“Enter a value for y: “))
z = int(input(“Enter a value for z: “))
f = ((((x – 0.5) * y) ** 0.5 + 1) / 1) + (1 + y * (x ** z)) * ((z+1) ** 0.5 * 4 + 1 – (z ** y) / 1)
print(‘f = ‘ +str(f))
Enter a value for x: 100
Enter a value for y: 1
Enter a value for z: 2
f = 59298.935474656995
Task 4:
this task, you are to write a function and for-loops that outputs the shape like the one below. Allow the user to specify how high the shape should be.
Instructions
Your function should take one argument: the height of the shape and then print the shape based on the value of the height
Requirements
To achieve full marks for this task, you must follow the instructions above when writing your solution. Additionally, your solution must adhere to the following requirements:
- You must implement the for-loops and print inside the function.
- Appropriate data types must be used for all user inputs.
- Your solution must not add any more lines of code outside the function implementation.
Example Runs
Run 1
Enter the height: 3
*
***
*****
*^*
^
Run 2
Enter the height: 5
*
***
* # *
* # *
*********
* ^ *
* ^ *
*^*
^
Run 3
Enter the height: 7
*
***
* # *
* # *
* # *
* # *
*************
* ^ *
* ^ *
* ^ *
* ^ *
*^*
^
Run 4
Enter the height: 10
*
***
* # *
* # *
* # *
* # *
* # *
* # *
* # *
*******************
* ^ *
* ^ *
* ^ *
* ^ *
* ^ *
* ^ *
* ^ *
*^*
^
To check for correctness, ensure that your program gives the same outputs as in the examples, as well as trying it with other inputs.
Get Solution of this Assessment. Hire Experts to solve this assignment for you Before Deadline.
Recent Solved Questions
- CHCCCS023: The Candidate Must Show Evidence Of The Ability To Complete Tasks: Support Independence And Wellbeing-Disability Course Work, VU, Australia
- Commercial Law Assignment (BULAW5914) Federation Business School CRICOS Provider No. 00103D (VIC); 01266K (NSW); 02235J (SA)
- The Brain Is An Organ Weighing Around 3 Pounds/1.3 Kilograms: Physiology Of The Brain Assignment, MU, Australia
- Community Engagement Assessment Australia
- SITXHRM003: Describe The Importance Of Each Of The Following Tasks Completed: Lead And Manage People Assignment, VU, Australia
- SITXFIN003: List 8 Examples For Financial Records: Manage Finances Within A Budget Assignment. VU, Australia
- The following career episode is on the basis of the project titled “Satellite Communication and This project was carried out by me when I was working: Telecommunications Engineer Assignment, MU, Australia
- ACCT5001: Look into the Annual Report/ Sustainability Report and Comment on What Rio Tinto Contribution is to SDG’s: Foundation in Accounting Report, UOS
- PSYC307: The limbic system: the brain region located on either side of the thalamus, just under the cerebrum It includes the hypothalamus: Emotions Assignment, UNE, Australia
- STAT1122: A gumball machine located near David Jones at the Marion Shopping Centre in Adelaide contains 1568 gumballs: Biostatistics Assignment, FU, Australia