0% found this document useful (0 votes)
5 views3 pages

Py Ass9

Uploaded by

venkatakalyan2nd
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)
5 views3 pages

Py Ass9

Uploaded by

venkatakalyan2nd
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/ 3

Python-Assignment 9 -ifelseAdv

Name : Gaduputi Venkata Kalyan

1. Write a program that takes a string input from the user and checks if the string is a valid
hexadecimal number. A valid hexadecimal number can include digits (0-9) and letters (a-f, A-F).
Print "Valid hexadecimal" if it is, and "Invalid hexadecimal" if it isn't.

2. Write a program that takes three integer inputs from the user and checks if they can form a
valid triangle. Print "Valid triangle" if the sum of any two sides is greater than the third side, and
"Invalid triangle" otherwise.
3. Write a program that takes a user's input and checks if it is a valid email address. A valid email
address should contain exactly one "@" symbol and at least one "." symbol after the "@" symbol.
Print "Valid email" if it is, and "Invalid email" if it isn’t.

4. Write a program that takes four integer inputs from the user and checks if they can form a valid
rectangle. Print "Valid rectangle" if both pairs of opposite sides are equal, and "Invalid rectangle"
otherwise.
5. Write a program that takes a list of integers as input and checks if the list is sorted in ascending
order. Print "Sorted" if it is, and "Not sorted" if it isn't.

6. Write a program that takes a user's age as input and prints their age group. Age groups are as
follows:

"Child" for ages 0-12


"Teenager" for ages 13-17
"Young Adult" for ages 18-35
"Adult" for ages 36-60
"Senior" for ages 61 and above

You might also like