You have a unique id number, which is represented by the variable id, containing a string of numbers. write a program that continuously takes strings to standard input. if the string is not your id number, print "this is not your id number." if it is, print "this is your id number: " followed by the number, and terminate the loop.

Respuesta :

idNumber = "123456"
idNo = input("Enter the unique ID number: ")
while idNumber != idNo:
print("This is not your ID number.")
idNo = input("Enter the unique ID number: ")
print("This is your ID number: ", idNo)

Output:

sh-4.3$ python3 main.py                                                                                                                                                                                                                                                

Enter the unique ID number: 2345                                                                                                                                                                                                                                       

This is not your ID number.                                                                                                                                                                                                                                            

Enter the unique ID number: 4563                                                                                                                                                                                                                                       

This is not your ID number.                                                                                                                                                                                                                                            

Enter the unique ID number: 12345                                                                                                                                                                                                                                      

This is not your ID number.                                                                                                                                                                                                                                            

Enter the unique ID number: 123456                                                                                                                                                                                                                                     

This is your ID number:  123456

To print a unique ID number which is represented by a variable and it contains string of numbers . For this, first declare the unique ID then create a variable that take inputs from the keyboard. After this, create a loop that will match with your unique number (ID). Lastly, display a message if ID is matched then print ‘This is your ID number’ and if it is not matched then print ‘This is not your ID number’.

Further Explanation:

Code:

The complete code in python language for the given problem is shown below:

# Your unique ID number

id = "12345"

# Enter the ID  number

number = input ("Enter an ID: ")

# Loop to match the ID number with input

while id !=number:

# Print the message

print ("This is not your ID number")

number = input ("Enter an ID: ")

print("This is your ID number:", number)

Output:

Run the commands in python, the output will be looking as below:

Enter the unique ID number: 24345

This is not your ID number

Enter the unique ID number: 1345                                                    

This is not your ID number

Enter the unique ID number: 12345  

This is your ID number

Enter the unique ID number: 35645                                                

This is not your ID number

Learn more:

1. A company that allows you to license software monthly to use online is an example of ? brainly.com/question/10410011  

2. Prediction accuracy of a neural network depends on _______________ and ______________. brainly.com/question/10599832  

Answer details:

Grade: College Engineering

Subject: Computer Science and Engineering

Chapter: Python Programming

Keyword:

Python, input, output, programming, statements, if-else, loops, print, scan. while, body, main body, char, int, variables, unique, ID number, match