Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b31fe79

Browse files
Merge pull request avinashkranjan#1879 from pavansai5448/master
[GSSoC'23] Arbitary Quotes Generator
2 parents 8284797 + b1835bf commit b31fe79

File tree

4 files changed

+71
-14
lines changed

4 files changed

+71
-14
lines changed

‎Arbitary Quotes Generator/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Arbitary Quotes Generator
2+
3+
## Description
4+
5+
This is a simple random quotes generator that provides a specified number of quotes based on a chosen category. The user can input the number of quotes they want and select a specific category for the quotes.
6+
The Category includes
7+
8+
- Inspirational
9+
- Motivational
10+
- Funny
11+
- Love
12+
- Life
13+
14+
Upon these Categories the user has to choose 1 and give a number which indicates the number of quotes needed to be generated in that category.
15+
16+
## Features
17+
18+
- Generates random quotes based on user input.
19+
- Allows the user to choose a specific category for the quotes.
20+
- Provides the flexibility to specify the number of quotes desired.
21+
22+
## Modules Used
23+
24+
- Random
25+
- Quote
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import random
2+
import quote
3+
4+
def generate_quotes():
5+
print("1. Inspirational")
6+
print("2. Motivational")
7+
print("3. Funny")
8+
print("4. Love")
9+
print("5. Life")
10+
choice = int(input("Enter your choice: "))
11+
if choice == 1:
12+
search_term = "inspirational"
13+
elif choice == 2:
14+
search_term = "motivational"
15+
elif choice == 3:
16+
search_term = "funny"
17+
elif choice == 4:
18+
search_term = "love"
19+
elif choice == 5:
20+
search_term = "life"
21+
else:
22+
print("Invalid choice!")
23+
return
24+
quotes = quote.quote(search_term)
25+
num = int(input("Enter the No. of quotes to generate: "))
26+
for i in range(num):
27+
print(i+1 ,".", random.choice(quotes)['quote'])
28+
29+
30+
generate_quotes()

‎Digital Clock/Clock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ def time():
1818
label.pack(anchor='center')
1919
time()
2020

21-
mainloop()
21+
mainloop()
Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
#function which finds out individual term of the fibonacci sequence
2-
def fibo(x):
3-
if(x == 1 or x == 2): #base case
4-
return 1
1+
def fibo(n):
2+
if n <= 0:
3+
return []
4+
elif n == 1:
5+
return [0]
6+
elif n == 2:
7+
return [0, 1]
58
else:
6-
return fibo(x-1) + fibo(x-2)
7-
#following the actual way how the fibonacci series is generated i.e. adding the previous two terms
9+
sequence = [0, 1]
10+
for i in range(2, n):
11+
sequence.append(sequence[i-1] + sequence[i-2])
12+
return sequence
813

914
n = 0
10-
while(n<=0):
11-
n = int(input("Enter how many terms do you need in your Fibonacci Sequence? "))
12-
#this loop is just to ensure that the user inputs a valid number
15+
while n <= 0:
16+
n = int(input("Enter how many terms you need in your Fibonacci Sequence: "))
1317

14-
for i in range(1,n):
15-
#finding out individual terms of the series and printing till (n-1) terms since we don't want an extra comma at the end
16-
print(fibo(i), end=", ")
17-
print(fibo(n)) #printing the last(i.e. nth term)
18+
fib_sequence = fibo(n)
19+
print(", ".join(map(str, fib_sequence)))

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /