Skip to content

Commit ee5ee43

Browse files
committed
7 files added
1 parent b733595 commit ee5ee43

File tree

9 files changed

+65
-0
lines changed

9 files changed

+65
-0
lines changed
380 Bytes
Binary file not shown.

twenty(five).py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def sum_of_ascii(input_string):
2+
sum = 0
3+
for i in input_string:
4+
var = ord(i)
5+
sum = sum + var
6+
return sum
7+
total = sum_of_ascii('rudraksh')
8+
print(total)
9+

twenty(four).py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def string(my_string):
2+
if my_string.isupper():
3+
return True
4+
elif my_string.islower():
5+
return False
6+
print(string('RUDRAKSH'))
7+
8+

twenty(one).py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def table(n):
2+
for i in range(1,11):
3+
print(n*i)
4+
table(6)
5+
#to import any function we can use from file name functions import

twenty(seven).py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def alpha_freq(my_string):
2+
flag = 0
3+
for i in range(len(my_string)-1):
4+
if ord(my_string[i]) + 1 == ord(my_string[i+1]):
5+
flag += 1
6+
return flag
7+
my_value = alpha_freq('abcade')
8+
print(my_value)

twenty(six).py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#map function: map(ord, lst/str/[])
2+
# def sum_of_ascii(input_string):
3+
# return sum(map(ord, input_string))
4+
5+
# map(len, [['shiv'], ['ank']]) #1
6+
def generate_password(username , password):
7+
username = username[:4]
8+
password = password[-4:]
9+
10+
value = username + password
11+
return value
12+
last_pass = generate_password('rudraksh' , '12345678')
13+
print(last_pass)

twenty(three).py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def mylist():
2+
lst=[1,2,3]
3+
return lst
4+
print(mylist())

twenty(two).py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from twentyfunction import factorial
2+
print(factorial(6))

twentyfunction.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# def greet():
2+
# print("hello world")
3+
# return 'hi mars!'
4+
# var = greet()
5+
# print(var)
6+
7+
def factorial(n):
8+
fact = 1
9+
for i in range(1, n+1):
10+
fact = fact * i
11+
return fact
12+
fact_of_5 = factorial(5)
13+
fact_of_10 = factorial(10)
14+
print(fact_of_5)
15+
print(fact_of_10)
16+

0 commit comments

Comments
 (0)