How to exclude an input if a certain value is entered

Samardeep Khurana

I have done this code:

Num = int(input("Enter a large number: "))
Num2 = Num+10
print("If I added 10 to your number it would be:" , Num2)
print("The new number times 2 would be " , Num2*2)
count = 0
number = Num
while (number > 1):
  number = number//10
  count = count + 1
  i = 1
  for i in range(1,count+1):
  Num = Num+1*(10**i)
  i = i+1
print("adding one to every digit on your first number would be: " , Num + 1)

In this code I would like to end it if the integer 9 is in the value entered by the user. I do not know how Please help

If 9 is entered the code should just end and ouTPUT 9 IS INVALID

DirtyBit

Check if the user input num is 9 and exit with a message.

Num = int(input("Enter a large number: "))    
if Num == 9:
   print("Invalid Input")
   exit()
else:
    Num2 = Num + 10
    print("If I added 10 to your number it would be:", Num2)
    print("The new number times 2 would be ", Num2 * 2)
    count = 0
    number = Num
    while (number > 1):
        number = number // 10
        count = count + 1
        i = 1
        for i in range(1, count + 1):
            Num = Num + 1 * (10 ** i)
        i = i + 1
    print("adding one to every digit on your first number would be: ", Num + 1)

OR if the intention is to check if there is 9 in the input.

Num = str(input("Enter a large number: "))
if "9" in Num:
    print("Invalid Inputs")
    exit()

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to get the value of input field entered in navigation

How to compare the value entered through input box

How to add text to the input after the entered value

How to exclude numbers in factor program ? AND How to re prompt user until a certain number is entered?

How to allow any value to be entered in input in React-Select

How to disable the remaining input field depend upon the value entered in the textfield?

How to display the span once the value is entered in input field? Angular JS

How to insert the value entered in <input type="time"/> into database?

How to check if a value entered is an integer or string when using input

How to live count input if value is entered or active by using javascript

How to get the value entered in the input after replacing it with asterisk (*)?

How to exclude certain value of an array with lodash or any other better method

How to exclude a whole group if one record contains a certain value?

JSON to HTML exclude certain value

Exclude certain value in order by and duplicate

How to restrict input field value to certain number

How do I restrict an input to a certain value?

How to create an exception that doesn't accept certain amount of numbers entered in input dialog?

How do I make an input box which forwards the user to a separate page when a certain code is entered?

How to add a class to an input when input containes a certain value with jquery

How to show a input text field when a value is entered in input number type field in javascript?

How do I check that random value equals entered value to input in php on post

How do I change the innerHTML of a date input to make the value match the currently user-entered value?

catch the input event when a value is entered

Vue on input value entered, move on to next field

Find the value entered by a color input in Javascript

setting the max value to be entered in my input[number]

Exclude certain rows while calculating the minimum value

Reversing string from user input, repeating until certain string is entered