0% found this document useful (0 votes)
8 views1 page

Coding Programs For Class

The document contains a Python script that prompts the user for their name and age, checks if the name consists of alphabetic characters, and validates the age input. It also includes a section that takes two numbers as input and performs division, with a check for invalid second number input. The script uses conditional statements and loops to handle user input and validation.

Uploaded by

kangc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

Coding Programs For Class

The document contains a Python script that prompts the user for their name and age, checks if the name consists of alphabetic characters, and validates the age input. It also includes a section that takes two numbers as input and performs division, with a check for invalid second number input. The script uses conditional statements and loops to handle user input and validation.

Uploaded by

kangc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

name = input("name: \n")

x = name.isalpha()
print (x)

----------------------------------------------------------------------------------------------------------------------------

number = int(input("age? \n"))

while number <= 1 or number >= 99:


print("False")
Break

else :
print(str(number) + " is True")
name1 = input("first name: \n")
x = name1.isalpha()
name2 = input("last name: \n")
y = name2.isalpha()
print (x,y)

----------------------------------------------------------------------------------------------------------------------------

num1 = int(input("first num: \n"))


num2 = int(input("second num: \n"))
if num2<=0:
print("invalid")
exit()
print(num1/num2)

----------------------------------------------------------------------------------------------------------------------------

You might also like