Functions Module
Functions Made By Me
r"""
Provides Some Daily Used Essential Functions.
Made By |-|/\S|-||R
"""
from functools import reduce
# FUNCTIONS
def prct():
"""THIS PROGRAM PRINTS PERCENTAGE OF OBTAINED MARKS.
"""
print(prct.__doc__)
n = input(
'Enter the obtained numbers within total numbers (eg: 77/100) or q to exit: '.title())
running = True
while running:
try:
if n == "q":
running = False
i = n.split('/')
print(f'{((float(i[0])/float(i[1]))*100):.3f}%')
n = input(
'Enter the obtained numbers within total numbers (eg: 77/100) or q to exit: '.title())
if n == "q":
running = False
except ValueError:
print('Please enter numbers and /')
continue
# if __name__ == '__main__':
# print(prct())
def tbl():
'''this is used to print tables,do not store it in a variable!!!
'''
try:
n = input('Enter number to make table: '.title())
for i in range(1, 11):
print(f'{n}X{i}={n*i}')
except Exception as e:
print('invalid input')
def decorationSymbol(n: int):
print('♀'*n)
def wadd():
'''
ADDS A SEQUENCE OF NUMBERS
'''
try:
a = input('enter sequence of numbers: '.capitalize())
lst = a.split(' ')
nlst = reduce(lambda x, y: int(x)+int(y), lst)
print(nlst)
except Exception:
print('error occured'.title())
reverse: slice = slice(None, None, -1)
def speak(text: str or int) -> None:
"""
|USE THIS If You want The COMPUTER TO TALK TO YOU.(0nly works on Windows)|
"""
from win32com.client import Dispatch
speaker = Dispatch("SAPI.SpVoice")
speaker.Speak(str(text))
if __name__ == '__main__':
string = "proboiz"
# speak(string[reverse])
# print(wadd.__doc__)
# wadd()
# Made By Hashir Ahmad
Updated Code
ReplyDelete