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
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.
Comments