Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Even_Odd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Create a function (or write a script in Shell) that takes an integer as
# an argument and returns "Even" for even numbers or "Odd" for odd numbers.
def even_or_odd(number):
if number % 2 == 0:
return "Even"
else:
return "Odd"
17 changes: 17 additions & 0 deletions First_non_repeating.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Write a function named first_non_repeating_letter that takes a
# string input, and returns the first character that is not repeated anywhere in the string.
#For example, if given the input 'stress',the function should return 't', since the letter
#t only occurs once in the string, and occurs first in the string.
#As an added challenge, upper- and lowercase letters are considered the same character, but the function
#should return the correct case for the initial letter. For example,the input 'sTreSS' should return 'T'.
#If a string contains all repeating characters, it should return an empty string ("") or None -- see sample tests.
def first_non_repeating_letter(string):
string_upper = string.upper()
upper_string = list(string_upper)
string_length = len(upper_string)
for i in range(0,string_length):
if upper_string.count(upper_string[i]) == 1:
return string[i]
else:
continue
return ""
4 changes: 4 additions & 0 deletions multiply.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# A function to multiply two numbers
def multiply(a, b):
result=a * b
return result
5 changes: 5 additions & 0 deletions sum_of_digits.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def digital_root(n):
if(n < 10):
return n
n=n%10+digital_root(n//10)
return digital_root(n)
8 changes: 8 additions & 0 deletions vowel_count.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def get_count(input_str):
input_str="PYTHON is fun"
for char in input_str:
if char in "aeiouAEIOU":
num_vowels = num_vowels+1

# your code here
return num_vowels