Write a python program that does the following.
a. It asks the user to enter a 5-digit integer value, n.
b. The program reads a value entered by the user. If the value is not in the right range, the program should terminate.
c. The program calculates and stores the 5 individual digits of n.
d. The program outputs a “bar code” made of 5 lines of stars that represent the digits of the number n.
For example, the following represents one run of the program. (The user chooses the number 16384.)
Enter a 5 digit integer: 16384
*
******
***
********
****
Please use python
Answer:
Explanation:
Here is the code which first takes as input an integer n and then if the integer is correct, all the 5 digits of the integer are taken out and stored.
Then asterisks are printed according to those stored variables a, b, c, d, e
feel free to comment if you need any help!
Code:
n = int(input("Enter a 5-digit integer: "))
if(n>=10000 and n<=99999):
e = n%10
n = n//10
d = n%10
n = n//10
c = n%10
n = n//10
b = n%10
n = n//10
a = n%10
print('*'*a)
print('*'*b)
print('*'*c)
print('*'*d)
print('*'*e)
Output:
PLEASE UPVOTE IF YOU FOUND THIS HELPFUL!
PLEASE COMMENT IF YOU NEED ANY HELP!
Write a python program that does the following. a. It asks the user to enter a...
in python only 15. Write a program that reads a five-digit positive integer and breaks it into a sequence of individual digits. For example, the input 16384 is displayed as 16384
Python Write a program that asks the user for a zip code and converts it to a postal bar code. A postal bar code uses two types of lines long and short. Since we can't print "long line” we will use: 0 - short line 1 - long line. The digits are represented by bars as explained in the below chart Value Encoding 1 00011 2 00101 00110 01001 01010 01100 10001 8 10010 9 10100 0 11000 The bar...
***USING PYTHON***Write a program that reads a five-digit positive integer and breaks it into a sequence of individual digits. for example , thin put 16384 is displayed as: 1 6 3 8 4
Write a program in Python that asks the user for the ISBN of the book in the format xxx-x-xxx-xxxxx-x. To validate: Initialize a total to 0 Have the program remove the dashes so that only the 13 digits are left in the ISBN string for each index of the first 12 digits in the 13 digit ISBN string get the digit at the current index as an integer If the current index is an even number, add the digit to...
In Python: Write a well-documented (commented) program that asks the user for a 9-digit integer, computes its checksum, and then prints the corresponding ISBN number. The International Standard Book Number (ISBN) is a 10-digit code that uniquely specifies a book. The rightmost digit is a checksum digit that can be uniquely determined from the other 9 digits, from the condition that d1 + 2d2 +3d3 + ... + 10d10 must be a multiple of 11 (here di denotes the ith...
In Python Write a well-documented (commented) program that asks the user for a 9-digit integer, computes its checksum, and then prints the corresponding ISBN number. The International Standard Book Number (ISBN) is a 10-digit code that uniquely specifies a book. The rightmost digit is a checksum digit that can be uniquely determined from the other 9 digits, from the condition that d1 + 2d2 +3d3 + ... + 10d10 must be a multiple of 11 (here di denotes the ith...
Write a program that asks the user to enter a string and then asks the user to enter a character. The program should count and display the number of times that the specified character appears in the string. python programming
NASM ASSEMBLY WINDOWS DOSBOX: 5) Write assembly program that asks the user to enter a number ( the user should input any integer number, say N), then the program outputs N if N is even; or N+3 if N is odd ( note: the output is always even) Example: Enter any number: 25 Even output is: 28 Another example: Enter any number: 32 Even output is: 32.
python program 6 Write an input validation loop that asks the user to enter a number in the range of 100 through 1000? 7 Write an input validation loop that asks the user to enter ‘Y’, ‘y’, ‘N’, or ‘n’? 8 How many times the following loop will repeat? cnt = 0 while cnt != 5: print(cnt) cnt = cnt + 2
In Python, write a program that asks the user for a positive integer number. If the user enters anything else, the program would ask the user to re-enter a number or enter -1 to quit. If it is a positive number, the program then prints out a multiplication table that goes up to that number. For example, if the user enters 10, the output would look something like this. https://www.vectorstock.com/royalty-free-vector/multiplication-table-on-white-background-vector-2721686