1. Write a program that generates a random number between 1 and 10 and prints your name that many times.

2. Write a program that generates a random decimal number between 1 and 10 with two decimal places of accuracy. Examples 1.23, 3.45,9.80, and 5.00. (Hint: use uniform() function from random module.

Respuesta :

The program that generates a random number between 1 and 10 and print your name that many times is as follows:

import random

a = random.randint(1,10)

name = input("write your name: ")

print(a * (name+"\n")  )

The program that generates a random decimal number between 1 and 10 with two decimal places of accuracy is as follows:

import random

print(round(random.uniform(1, 10), 2))

Code explanation:

1.

  • We import random module
  • The variable a is use to store the random number generated between 1 and 10.
  • The variable name is used to store the user input(name of the user)
  • Then we print the name the number of times the random number we generated.

2.

  • We import the random module
  • Then print the random float number generated in two decimal places between 1 and 10

learn more on python program here: https://brainly.com/question/16403687?referrer=searchResults

Ver imagen vintechnology
Ver imagen vintechnology
Ver imagen vintechnology
ACCESS MORE
EDU ACCESS