Skip to content

Commit 27e3b59

Browse files
ISBN number 😎
1 parent 7d76916 commit 27e3b59

File tree

5 files changed

+96
-39
lines changed

5 files changed

+96
-39
lines changed

Auto-Linkedin /AutoLinkedIn.py

Lines changed: 0 additions & 26 deletions
This file was deleted.

Auto-Linkedin /README.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

ISBN-Number-Validator/ISBN-Number.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Checking entered number is a isbn number or not
2+
def valid_ISBN(isbn):
3+
# Remove hyphens and spaces from the ISBN
4+
isbn = isbn.replace('-', '').replace(' ', '')
5+
6+
# Check if the length of the ISBN is valid
7+
if len(isbn) == 10:
8+
return valid_ISBN10(isbn)
9+
elif len(isbn) == 13:
10+
return valid_ISBN13(isbn)
11+
else:
12+
return False
13+
14+
# Checking the entered number is a valid 10-digit isbn number
15+
def valid_ISBN10(isbn):
16+
# Check if the ISBN is valid according to the ISBN-10 algorithm
17+
if not isbn[:-1].isdigit() or not isbn[-1] in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'X']:
18+
return False
19+
20+
# Calculate the check digit
21+
checkDigit = 0
22+
weight = 10
23+
for digit in isbn[:-1]:
24+
checkDigit += int(digit) * weight
25+
weight -= 1
26+
27+
checkDigit %= 11
28+
if isbn[-1] == 'X':
29+
checkDigit = 'X'
30+
31+
# Validate the check digit
32+
return str(checkDigit) == isbn[-1]
33+
34+
# Checking the entered number is a valid 13-digit isbn number
35+
def valid_ISBN13(isbn):
36+
# Check if the ISBN is valid according to the ISBN-13 algorithm
37+
if not isbn.isdigit():
38+
return False
39+
40+
# Calculate the check digit
41+
checkDigit = 0
42+
weight = [1, 3] * 6
43+
for digit, w in zip(isbn[:-1], weight):
44+
checkDigit += int(digit) * w
45+
46+
checkDigit %= 10
47+
checkDigit = (10 - checkDigit) % 10
48+
49+
# Validate the check digit
50+
return str(checkDigit) == isbn[-1]
51+
52+
53+
# Ask the user to enter an ISBN number
54+
isbnNumber = input("\nEnter an ISBN number: ")
55+
56+
# Validate the ISBN number
57+
if valid_ISBN(isbnNumber):
58+
print("\nValid ISBN number.\n")
59+
else:
60+
print("\nInvalid ISBN number.\n")
61+

ISBN-Number-Validator/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<h1 align="center">ISBN NUMBER VALIDATOR</h1>
2+
3+
_______________________________________________________________________
4+
5+
<br>
6+
7+
## What is it
8+
9+
- Full form of ISBN number - International Standard Book Numbers.
10+
- ISBNs are unique identifiers assigned to books.
11+
- They can have either 10 or 13 digits, depending on the edition and publication date.
12+
- This python script can verify the entered number is valid isbn number or not.
13+
14+
15+
<br>
16+
17+
## TechStack
18+
19+
use python 3 and above to use this **ISBN NUMBER VALIDATOR** program.
20+
21+
22+
<br>
23+
24+
## Screenshot 📸
25+
26+
![image](https://github.com/avinashkranjan/Amazing-Python-Scripts/assets/114330097/5cb881a1-2922-4a57-b2df-d3546ce65652)
27+
28+
29+
<br>
30+
31+
## Created By 👦
32+
33+
[Avdhesh Varshney](https://github.com/Avdhesh-Varshney)
34+

SCRIPTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,5 @@
106106
| 104\. | Audio splitting script | This Python script allows you to split large audio files into smaller segments based on silence, making them suitable for transcription or further analysis. | [Take Me](https://github.com/avinashkranjan/Amazing-Python-Scripts/tree/master/Audio\Splitting) | [Srujana Vanka](https://github.com/srujana-16) |
107107
| 105\. | Hangman game script | The Hangman game is a classic word-guessing game where the player tries to guess a secret word within a certain number of attempts. | [Take Me](https://github.com/avinashkranjan/Amazing-Python-Scripts/tree/master/hangman) | [Srujana Vanka](https://github.com/srujana-16)
108108
| 106\. | Fleury Algorithm | Fleury algorithm is used to find the euclerian circuit but this algorithm can also find the path in the disconnected graph also. | [Take Me](./Fleury-Algorithm) | [Avdhesh Varshney](https//github.com/Avdhesh-Varshney)
109+
| 107\. | ISBN Number Validator Script | Full form of ISBN number - International Standard Book Numbers. This python script can verify the entered number is valid isbn number or not. | [Take Me](./ISBN-Number-Validator/) | [Avdhesh Varshney](https://github.com/Avdhesh-Varshney)
109110

0 commit comments

Comments
 (0)