Question

use PYTHONAssignment 4 O Lets make random IDs. Get the number of IDs from the user to make from the keyboard. Then print the IDs. O NoAssignment 5 O Write a program to display the result of tossing a coin N times. N is given from the user. Then find and displ

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import string

import random

num_of_ids=int(input("Enter the numbe of ID's"))

alphabet_digit_list=string.ascii_letters+string.digits

print(len(alphabet_digit_list))

ids=list()

for x in range(num_of_ids):

s=""

for i in range(11):

s=s+alphabet_digit_list[random.randint(0,len(alphabet_digit_list)-1)]

ids.append(s)

for x in ids:

print(x)

https://TornLegal Matter.koteswariinduri.repl. run g main.py saved import string import random 3 num_of_ids=int(input(Enter

Please post other questions in separate post as per policy we have to answer 1 question per post. Please post separately .Thank you

Add a comment
Know the answer?
Add Answer to:
use PYTHON Assignment 4 O Let's make random IDs. Get the number of IDs from the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In python.. If we want the computer to pick a random number in a given range...

    In python.. If we want the computer to pick a random number in a given range say to write code for Picking a random element from a list or pick a random card from a deck, flip a coin etc. we can use Random module The Random module contains some very useful functions one of them is randrange() randrange(start, stop) Example from random import randrange for i in range (3): print ("printing a random number using randrange(1, 7)",r andrange(1, 7))...

  • Python code You will need to make use of the random library for this homework. It...

    Python code You will need to make use of the random library for this homework. It is pretty simple to use. You can use the following methods: random.choice(list) returns a single item from the list, tuple or string at random. random.sample(list.o - returns a new list of n items randomly chosen from the list, tuple or string random shufflellist)randomly reorders all of the items in the list and changes the list itself. The list must be a mutable object so...

  • In this problem you'll get to use one of Java's random number generators, java.util.Random (see the...

    In this problem you'll get to use one of Java's random number generators, java.util.Random (see the docs for Random). This class generates a random double precision number uniformly distributed in the range [0.0 ... 1.0). That is, the numbers go from 0 to 1, including 0 but excluding 1. It is a common need in Java programming to generate a random integer number that's uniformly distributed in the range of [0 ... n), such as we saw in the dice...

  • This is Python The program should accept input from the user as either 7-digit phone number...

    This is Python The program should accept input from the user as either 7-digit phone number or 10-digit. If the user enters 7 characters, the program should automatically add "512" to the beginning of the phone number as the default area code. Dash (hyphen) characters do not count in input character count, but must not be random. If the user enters dashes the total character count must not exceed 12. The program should not crash if the user enters invalid...

  • Random Number Generation and Static Methods Write a program that simulates the flipping of a coin...

    Random Number Generation and Static Methods Write a program that simulates the flipping of a coin n-times to see how often it comes up heads or tails. Ask the user to type in the number of flips (n) and print out the number of times the coin lands on head and tail. Use the method ‘random()’ from the Math class to generate the random numbers, and assume that a number less than 0.5 represents a tail, and a number bigger...

  • Language: C++ PLEASE INCLUDE SCREENSHOT OF OUTPUT In this assignment, you will consider the problem of organizing a collection of computer user-ids and passwords. Each time a user logs in to the syste...

    Language: C++ PLEASE INCLUDE SCREENSHOT OF OUTPUT In this assignment, you will consider the problem of organizing a collection of computer user-ids and passwords. Each time a user logs in to the system by entering his or her user-id and a secret password, the system must check the validity of this user-id and password to verify that this is a legitimate user. Because this validation must be done many times each day, it is necessary to structure this information in...

  • Number 1) Which of the following statements imports a module into the default namespace? a. from...

    Number 1) Which of the following statements imports a module into the default namespace? a. from temperature import * b. import temperature as t c. import temperature as temp d. import temperature Number 2) Which of the following statements imports a module into the global namespace? a.from temperature import *   b. import temperature as temp c. import temperature as global d. import temperature Number 3) Code Example 4-2 def get_volume(width, height, length=2):     volume = width * height * length...

  • Q1. 4 points You've recently bought a "random number generator (RNG) from an online retailer. Everytime...

    Q1. 4 points You've recently bought a "random number generator (RNG) from an online retailer. Everytime you push a button of the RNG, it generates a nine-digit long random number (number consisting of random nine-digits from 0-9). How many times do you need to push the button in order to guarantee that at least two of the numbers generated by the RNG have the first 3 digits common? Fully evaluate the result TOUR OF ACCOUNTING OVER HERE LE HAVE OUR...

  • Write a program that writes a series of random numbers to a file. Each random number...

    Write a program that writes a series of random numbers to a file. Each random number should be in the range of 1 through 500 inclusive. 1.Use a file called randoms.txt as a input file and output file a. If you go to open the file and its not there then ask the user to create the file     and then quit 2. Ask the user to specify how many random numbers the file will hold. a.Make sure that the...

  • use python code complete this question 'Assignment 3 o Get information until getting 'n' from user...

    use python code complete this question 'Assignment 3 o Get information until getting 'n' from user Input the name of 1th student : 84 Input the math score of 1th student : 90 Input the english score of 1th student : 80 Input the science score of lth student : 100 Keep moving? (y/n): y Input the name of 2th student : 981 Input the math score of 2th student : 70 Input the english score of 2th student :...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT