0% found this document useful (0 votes)
21 views2 pages

ADSA Worksheet Template

full worksheet template

Uploaded by

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

ADSA Worksheet Template

full worksheet template

Uploaded by

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

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Worksheet 2

Student Name: Prakash Kumar UID: 23BCS11511


Branch: B.E –CSE Section/Group: 701-B
Semester: 3rd Date: 27-08-24
Subject Name: Python Programming Subject Code: 23CSP-201

1. Aim: A user registration needs a function to validate email address.


create a function is_valid_email(email:str)->bool that takes an email
address as string and return True if its valid false otherwise.

2. Requirements (Hardware/Software):

- Compiler/ Interpreter of Python.


- Visual Studio code

3. Procedure:

#The input code of above program is

def is_valid_email(email: str) -> bool:

if "@" not in email or email.count("@") != 1:


return False

at_position = email.index("@")

if "." in email[at_position:] and email[-1] != ".":


return True

return False
user_email = input("Enter your email address: ")

if is_valid_email(user_email):
print("The email address is valid.")
else:
print("The email address is not valid.")

4. Output:

5. Learning Outcome:

 Gain a solid understanding of string operations in Python, including splitting,


joining, and reversing sequences.

 Learn how to handle and manipulate different types of text data, including
handling punctuation and whitespace.

 Learn how to design functions that are modular and easily integrated into
larger software systems.
 Understand the principles of writing reusable code that can be easily adapted or
extended for future use.

You might also like