Question

In: Computer Science

Write a Python program that prints 20 “random” license plate numbers, each one consisting of three...

Write a Python program that prints 20 “random” license plate numbers, each one consisting of three randomly-chosen digits followed by three randomly chosen upper-case letters. The first digit cannot be zero. Sample output might look like: 382 HGK 819 YEU

Solutions

Expert Solution

Python code:

#importing necessary modules

from random import randint

import random

import string

for i in range(20):

    #printing 3 digit random number

    print(randint(100,999),end=" ")

    #obtaining all uppercase alphabets

    character=string.ascii_uppercase

    #creating length 3 uppercase characters

    str1=''.join(random.choice(character) for i in range(3))

    #printing characters

    print(str1)

Screenshot:

Output:


Related Solutions

Python Assume s is a string of numbers. Write a program that prints the longest substring...
Python Assume s is a string of numbers. Write a program that prints the longest substring of s in which the numbers occur in ascending order and compute the average of the numbers found. For example, if s = '561984235272145785310', then your program should print: Longest substring in numeric ascending order is: 14578 Average: 5 In the case of ties, print the first substring. For example, if s = '147279', then your program should print Longest substring in numeric ascending...
In python write a program which prints the longest substring of numbers which occur in ascending...
In python write a program which prints the longest substring of numbers which occur in ascending order s=342153476757561235
Python # Write a program that examines three variables—x, y, and z # and prints the...
Python # Write a program that examines three variables—x, y, and z # and prints the largest odd number among them. # If none of them are odd, it should print a message to that effect. n = input('Enter the 1st Integer x: ') x = int(n) n = input('Enter the 2nd Integer y: ') y = int(n) n = input('Enter the 3rd Integer z: ') z = int(n) if x % 2 == 0 and y % 2 ==...
Create a program that generates a file of random numbers, and then prints them in neat...
Create a program that generates a file of random numbers, and then prints them in neat fashion to another file, and also saves to that file the average and standard deviation of those numbers. I) First, you would need to generate a file of random numbers that consists of N random numbers (100 < N < 1000). Each random digit should be a real number (type double) between 0 and 50. This file and its digits would now serve as...
Python: I am making a program that prints a circle of random size, random location, with...
Python: I am making a program that prints a circle of random size, random location, with user_inputed (using entry) color, when 'DRAW' button is clicked. I am stuck on passing variables on the while loop. Please Help from graphics import* import sys import random from time import sleep def main(): win = GraphWin ('What Color', 500, 600) win.setCoords(0, 0, 500, 600) DB = Rectangle(Point(350, 580), Point(400, 560)) DB.setFill('light Green') DB.draw(win) QB = Rectangle(Point(430, 580), Point(480, 560)) QB.setFill('red') QB.draw(win) DB_t =...
One Problem/Question (Four Parts) Write a python program which prints a sequence of integers that are...
One Problem/Question (Four Parts) Write a python program which prints a sequence of integers that are multiples of 10, starting at 0 and ending at 100. Write a python program that computes the average of 10 random odd integers, ranging from 0 to 500. Write a python program that prints whatever the user enters, and stops when the user types “done”, using an infinite loop and a break statement. Same as number three but use a condition. The loop terminates...
Create this on Python Write a program that asks for three numbers. Check first to see...
Create this on Python Write a program that asks for three numbers. Check first to see that all numbers are different. If they’re not different, then exit the program. Otherwise, display the largest number of the three. Outputs: - Enter the first number: 4 - Enter the second number: 78 - Enter the third number: 8 (The largest number is 78.) Tasks - Complete the algorithm manually without using any built-in functions to find the largest number on list. -...
Write a program that computes and prints the average of numbers in a text file. I...
Write a program that computes and prints the average of numbers in a text file. I created a text file integers.txt that has the numbers 5,4,3,2,1. I need to define the average function Define the main function which will include the following things 1. prompt user for input of text file name 2. open and read input file, can be done before or inside high order functions 3. use two high order functions 4.calculate and display averages and original ist...
Assume s is a string of numbers. Write a program that prints the longest substring of...
Assume s is a string of numbers. Write a program that prints the longest substring of s in which the numbers occur in ascending order and compute the average of the numbers found. For example, if s = '561984235272145785310', then your program should print Longest substring in numeric ascending order is: 14578 Average: 5 In the case of ties, print the first substring. For example, if s = '147279', then your program should print Longest substring in numeric ascending order...
Write a Python program that reads in an amount in cents and prints the dollar amount...
Write a Python program that reads in an amount in cents and prints the dollar amount in that and the remaining value in cents. For example, if the amount reads in is 360 (cents), the program would print 3 dollars and 60 cents. if the amount read in is 75 (cents), the program would print 0 dollars and 75 cents.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT