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
- PUBH6034: Look up the Ten characteristics of a Servant Leader for practitioners in the chapter: Leadership and new public health Essay, CU, Australia
- Comment on the strategies employed by the therapist in this video to establish and maintain therapeutic rapport: Developing Skills in Contemporary Psychotherapies Report, SCU, Australia
- AMB336: Assess students’ ability to evaluate Internet technology’s impact on international marketing practice, identify critical digital marketing concepts: International Marketing Case Study, Queensland University, Australia
- BSBITU212: When is It Necessary to use a Spreadsheet rather than a Word Processing Application: Create and Use Spreadsheets Assignment, DU, Australia
- Using an Entrepreneurial Venture You Wish to Start (the New Venture can be a Stand-alone Entity: Entrepreneurship Assignment, CSU, Australia
- Brad is Planning a Short 3 day Holiday in Wellington, NZ (traveling next month): Software Development Assignment, MU, Australia
- Individualised Care Plan Patient Summary Mrs Thompson is an 87-year-old woman who lives alone: Communicate Homework, UOS, Australia
- COMR2002: Matilda is a not-for-profit private education organization. It provides online education in farming anywhere in the world: Business Information Systems, Case study, TUA, Australia
- HI5001: Urban Consulting, a building consulting firm has just started its business The owner of the firm engaged you to prepare yearly financial statements: Accounting for Business Decisions Assignment, HI, Australia
- The Following are the Years that the Big Market Crashes Happened Since 1900 in the US Stock Market: Economics Essay, CU, Australia