QuestionQuestion

1. Write a program that uses a function to calculate the double value of a number:

---Write a DOUBLE function that: 1) takes an input parameter and 2) returns the 2 * input parameter (the double)
---Then calls the DOUBLE function with parameter 3.1415 and then prints the return value

2. The program to write now is: "Guess a number between 1 and 100"
-The Python program should produce a secret number.
-The user may guess again and again until the guess is the same as the secret speech.
-Every time the user guesses, the python program should print "Guessing is too small", "Guessing is too big" or "You guessed right"

Random number tips:
from random import radint
number = radint (1,100)rnrn3.

The program to write now is "draw a triangle".
-The Python program should first ask for the width (positive integer, 0 or greater) and then draw a triangle.
-First row should be one star, second row two **, then *** until the number of stars is what was stated as width.
-Then the triangle ends by printing in the opposite way.
-The Python program must use for-loops.
-(Check out some multi-checks of the input, but do not need to make error checks as the user is considered to be kind)
-If the program only manages widths> = 2 stars, two points are deducted.

What a program run looks like:

Enter maximum width:

Enter maximum width: 5
*
**
***
****
*****
****
***
**
*

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

width = int(input("Enter maximum width: "))

for i in range(1, width+1):
    print('*' * i)...
$5.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Python Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats