-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
def sum_of_ascii(input_string): | ||
sum = 0 | ||
for i in input_string: | ||
var = ord(i) | ||
sum = sum + var | ||
return sum | ||
total = sum_of_ascii('rudraksh') | ||
print(total) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
def string(my_string): | ||
if my_string.isupper(): | ||
return True | ||
elif my_string.islower(): | ||
return False | ||
print(string('RUDRAKSH')) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
def table(n): | ||
for i in range(1,11): | ||
print(n*i) | ||
table(6) | ||
#to import any function we can use from file name functions import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
def alpha_freq(my_string): | ||
flag = 0 | ||
for i in range(len(my_string)-1): | ||
if ord(my_string[i]) + 1 == ord(my_string[i+1]): | ||
flag += 1 | ||
return flag | ||
my_value = alpha_freq('abcade') | ||
print(my_value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#map function: map(ord, lst/str/[]) | ||
# def sum_of_ascii(input_string): | ||
# return sum(map(ord, input_string)) | ||
|
||
# map(len, [['shiv'], ['ank']]) #1 | ||
def generate_password(username , password): | ||
username = username[:4] | ||
password = password[-4:] | ||
|
||
value = username + password | ||
return value | ||
last_pass = generate_password('rudraksh' , '12345678') | ||
print(last_pass) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
def mylist(): | ||
lst=[1,2,3] | ||
return lst | ||
print(mylist()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from twentyfunction import factorial | ||
print(factorial(6)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# def greet(): | ||
# print("hello world") | ||
# return 'hi mars!' | ||
# var = greet() | ||
# print(var) | ||
|
||
def factorial(n): | ||
fact = 1 | ||
for i in range(1, n+1): | ||
fact = fact * i | ||
return fact | ||
fact_of_5 = factorial(5) | ||
fact_of_10 = factorial(10) | ||
print(fact_of_5) | ||
print(fact_of_10) | ||
|