Skip to content

Commit 74bf2c5

Browse files
Adding 4 new programs
1 parent 9629aef commit 74bf2c5

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

camelCase-to-snake_case.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name = input("Enter name of variable in camelCase: ")
2+
3+
j = 0
4+
5+
for char in name:
6+
if char.isupper():
7+
print("_" + char.lower(), end = "")
8+
else:
9+
print(char, end = "")

meal-of-the-day.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
def main():
2+
x = convert(input("Enter time of the day [in hh:mm 24 hour format] : "))
3+
4+
if 7 <= x <= 8:
5+
print("breakfast time")
6+
elif 12 <= x <= 13:
7+
print("lunch time")
8+
elif 18 <= x <= 19:
9+
print("dinner time")
10+
11+
12+
def convert(time):
13+
hours, minutes = time.split(":")
14+
hours = int(hours)
15+
minutes = float(minutes)/60
16+
return hours + minutes
17+
18+
19+
if __name__ == "__main__":
20+
main()

remove-vowels.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
vowels = ['a', 'e', 'i', 'o', 'u']
2+
3+
text = input("Enter some text: ")
4+
5+
for char in text:
6+
if(char.lower() in vowels):
7+
continue
8+
else:
9+
print(char, end = '')

text-to-emoji.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def main():
2+
print(convert(input("Enter any text: ")))
3+
4+
def convert(text):
5+
return text.replace(":(", "🙁").replace(":)", "🙂")
6+
7+
main()

0 commit comments

Comments
 (0)