Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
17 views
Python 6,7,8
Uploaded by
prajwal pawar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Python 6,7,8 For Later
Download
Save
Save Python 6,7,8 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
17 views
Python 6,7,8
Uploaded by
prajwal pawar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Python 6,7,8 For Later
Carousel Previous
Carousel Next
Save
Save Python 6,7,8 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 6
Search
Fullscreen
SS : Practical No: 6 aE x > Programs yor poxe'ng of Jaro ,volidadions like
| email, val de > + Password Validation import re Pod = ‘xdebF gg! req "4 (1 =. ¥ [a-2]) (2 =. #0A-2)) C2 if teed J)fa-taz\dag leu *? Giz, t29F | 4 Compiling wegex match ve = 7e. compile (eq) + Beacching regex Tee =e. BearchCmate =, ¥\d) (2=.*10$1%* h_ve, pswd) He Volidlat'ng Conditions if Yee: print (“Valid password ") else: print (“Tnvalid password ") 4# Dviver Code if_ — name_— = main 0) Output: Thvabid Password. _— main --'4:"POR validahon — He Import: library import ve rH Url link , S= "https + // www. navishkh.ovg/ “Bio ding the protocol Objt =ve-Findau (' Cw): I, 8) Print (obj x) > AE Bind » [0 J 25 ve. Findall (°% [www (C{w\=\.74)',8) , | Print (obj 2) Outpub:- U https] ['navishkh . ovq'] eo ee 80 Oe 4 Email Validation Import ve 4& Make a reqular expression , [efor Validlecting an Email a-2) {2,74 \b' Ae Define a funchon for pe For Validahion an Email def check (emai) : +t pass the Tegular expression +t and the String Into fullmeatchO) method if (ee Fulmakch (regex , email )): print ("Valid Email”) rg hostname which may contain dash or dots regex = ¥'\ bIA-za-20-9._% + J+@ [A-za-z0-9,-J 4\. [Az | aI e eo *» s-e- 8 8 8-678: Sscee print (“Invalid Email”) # Drivee code \ #_ name_~ == ‘__ main Enter the email email = “
[email protected]
" Calling eran function check Cemai!) email = "mg. ownsite @our-earth.org” check Cemajl) email =" nai, com” check Cemail ) Outpub:- Valid Email Valid Email Tovab'd Email——--—- oeceoecoceoeoeeeeeeee oee535o5+cgeoe@8# wv we @ Practical No.8 P-Programs Covering all the aspects of Exception handling , 3 See defined exception, Multithreading should be covered. © Exception handling :- Xample 1: amount = 10000 iF Camount > 2999) PYINE ("You are eligible t0 purchase Osa self paced’) Ouspur: if (amount » 2999) “A Syntax Error: invalid Syntax Example 2: Maxks= 40000 a = maxks | 0 print Ca) Output i- ZexoDivision Error: division by Zexo Example 3: x a=[1,2,3) try: print ("Second elements vod "4. (a(al)) print ( Fourth element=%d" % (a [3})) except : pTID ("An exxor occured") Output :- second elements 2 An exror occured ©OR Example us det bye (a,b): try: c= (l(atb) | Ca-b)) Except zexoDivisionError: Print (“al bresut in oF else. printlo Aby® (2.0 ,3:0) Rbye (2-0 ,3-0) Output: -s-o albvrepult in 0 Example Sie try + vaiee Mame brror (“Hi there") except (Wametrror: Print C" an exception") raise © Oude = raise MameError (“ Wi there") Wamefrror: Hi there.B.2 multithreading im pore threading det print cube (num): Print (* cube 45" format (num * num * num) det Print. square (num): a Square .3F ” format (num * num)) fe —Name_-=="__ main. _” 4 Crecching thread +4 = threading -Threacl (targets print. square , args =10,)) t2 = threading, Thread (target = print_cube, args-1o,)) +4. Storch O tz. start 0 t1- joind +2. join0 print ("Done |") Outpur:- Square = 100 Cube = 1000 Donel ve @ @ w
You might also like
Python Harvard RegularExpressions
PDF
No ratings yet
Python Harvard RegularExpressions
20 pages
Python Notes
PDF
91% (11)
Python Notes
204 pages
CS50P Notes
PDF
No ratings yet
CS50P Notes
1 page
Power Sharing
PDF
No ratings yet
Power Sharing
3 pages
Python
PDF
No ratings yet
Python
4 pages
Prac 1
PDF
No ratings yet
Prac 1
5 pages
ue228120
PDF
No ratings yet
ue228120
8 pages
4
PDF
No ratings yet
4
4 pages
Module 5 File - Exception Handling
PDF
No ratings yet
Module 5 File - Exception Handling
5 pages
Challenges-18
PDF
No ratings yet
Challenges-18
4 pages
PYTHON 5 (1)
PDF
No ratings yet
PYTHON 5 (1)
2 pages
Python Unit 5
PDF
No ratings yet
Python Unit 5
16 pages
Python Chap 6
PDF
No ratings yet
Python Chap 6
47 pages
Practical 16
PDF
No ratings yet
Practical 16
4 pages
Module 5 File - Exception Handlina
PDF
No ratings yet
Module 5 File - Exception Handlina
3 pages
Unit 6
PDF
No ratings yet
Unit 6
9 pages
ICT582 Topic 08
PDF
No ratings yet
ICT582 Topic 08
37 pages
Exception Handling
PDF
No ratings yet
Exception Handling
6 pages
Python
PDF
No ratings yet
Python
31 pages
Py New U5
PDF
No ratings yet
Py New U5
44 pages
Untitled Document (37)
PDF
No ratings yet
Untitled Document (37)
7 pages
Exception Handling (CS)
PDF
No ratings yet
Exception Handling (CS)
23 pages
Python Language: Exceptions: The FOSSEE Group
PDF
No ratings yet
Python Language: Exceptions: The FOSSEE Group
24 pages
UNIT- V
PDF
No ratings yet
UNIT- V
14 pages
rakesh assignment 3
PDF
No ratings yet
rakesh assignment 3
19 pages
PRG1
PDF
No ratings yet
PRG1
5 pages
Unit4pdf__2022_11_18_19_07_30
PDF
No ratings yet
Unit4pdf__2022_11_18_19_07_30
25 pages
computer science class 12
PDF
No ratings yet
computer science class 12
3 pages
CLASS 12 NCERT SOLUTION COMPUTER SCIENCE CHAP 1 2024-25
PDF
No ratings yet
CLASS 12 NCERT SOLUTION COMPUTER SCIENCE CHAP 1 2024-25
20 pages
Module01 Wk02b Exceptions
PDF
No ratings yet
Module01 Wk02b Exceptions
11 pages
Unit4 ExceptionalHandlingpdf 2023 08 01 11 38 08
PDF
No ratings yet
Unit4 ExceptionalHandlingpdf 2023 08 01 11 38 08
24 pages
22MCA1061 Regx
PDF
No ratings yet
22MCA1061 Regx
18 pages
ADSA Worksheet Template
PDF
No ratings yet
ADSA Worksheet Template
2 pages
chapter 6 Question answers
PDF
No ratings yet
chapter 6 Question answers
13 pages
Validation Programs
PDF
No ratings yet
Validation Programs
5 pages
Chapter 13 Python
PDF
No ratings yet
Chapter 13 Python
55 pages
Python Tutorial_ Exception Handling
PDF
No ratings yet
Python Tutorial_ Exception Handling
1 page
Basic Exception Handling
PDF
No ratings yet
Basic Exception Handling
7 pages
Experiment 7-1
PDF
No ratings yet
Experiment 7-1
6 pages
Lecture_8#_comprehension_exceptions_2
PDF
No ratings yet
Lecture_8#_comprehension_exceptions_2
27 pages
Python Exception Handling PDF
PDF
100% (1)
Python Exception Handling PDF
23 pages
lab assignment-7
PDF
No ratings yet
lab assignment-7
5 pages
Design Language For Compiler
PDF
No ratings yet
Design Language For Compiler
6 pages
4 B
PDF
No ratings yet
4 B
5 pages
Exception Handling
PDF
No ratings yet
Exception Handling
13 pages
Practical PDF
PDF
No ratings yet
Practical PDF
29 pages
Exception_Handling_Notes
PDF
No ratings yet
Exception_Handling_Notes
3 pages
Beginners Python Cheat Sheet PCC Files Exceptions BW
PDF
No ratings yet
Beginners Python Cheat Sheet PCC Files Exceptions BW
2 pages
Unit-4 Exceptions Updated1
PDF
No ratings yet
Unit-4 Exceptions Updated1
29 pages
Day 3.2 - CH8 - Handling Errors
PDF
No ratings yet
Day 3.2 - CH8 - Handling Errors
21 pages
Python Notes_unit 4 (1)
PDF
No ratings yet
Python Notes_unit 4 (1)
13 pages
Exception Handling: B. L. Patil Polytechnic, Khopoli
PDF
No ratings yet
Exception Handling: B. L. Patil Polytechnic, Khopoli
17 pages
Python
PDF
No ratings yet
Python
13 pages
8.Document Solutions
PDF
No ratings yet
8.Document Solutions
4 pages
Exception Handling
PDF
No ratings yet
Exception Handling
13 pages
Mysql
PDF
No ratings yet
Mysql
5 pages
Exception Handling Python
PDF
No ratings yet
Exception Handling Python
2 pages