Practical No 7: Ex1: Create A Tuple and Find The Minimum and Maximum Number From It
Practical No 7: Ex1: Create A Tuple and Find The Minimum and Maximum Number From It
Output:
PS F:\Python\Practicals\7> python ex1.py
numTuple = (1, 2, 42, 42, 13, 41, 24, 3, -1)
Minimum Number of The numTuple Is : -1
Maximum Number of The numTuple Is : 42
Output:
PS F:\Python\Practicals\7> python ex2.py
Repeated Numbers In numTuple Are : [42, 3]
Ex3: Print the number in words for Example: 1234 => One
Two Three Four
Practical No 7
# Print the number in words for Example: 1234 => One Two Three Four
numbers_in_words = {
0:"Zero",
1:"One",
2:"Two",
3:"Three",
4:"Four",
5:"Five",
6:"Six",
7:"Seven",
8:"Eight",
9:"Nine",
}
num = int(input("Enter A Number : "))
print("Number In Word Are : ",end="")
for i in range (len(str(num))):
lenOfNum = len(str(num))
digit_places = int("1"+"0"*(lenOfNum-1))
digit = num//digit_places
num%=digit_places
print(numbers_in_words[digit],end=" ")
Output:
PS F:\Python\Practicals\7> python ex3.py
Enter A Number : 1234
Number In Word Are : One Two Three Four