├── BMI calculator
├── Base Converter
└── base_converter.py
├── Caesar Cipher
├── art.py
└── caesar_cipher.py
├── Calculator
└── main.py
├── Central Park Squirrel Data Analysis
├── .idea
│ ├── Central Park Squirrel Data Analysis.iml
│ ├── inspectionProfiles
│ │ └── profiles_settings.xml
│ ├── misc.xml
│ └── modules.xml
├── 2018_Central_Park_Squirrel_Census_-_Squirrel_Data.csv
├── main.py
└── squirrel_count.csv
├── Chat-bot
├── LICENSE
├── README.md
├── chatbots.py
└── requirements.txt
├── Coffee Machine - OOP
├── coffee_maker.py
├── main.py
├── menu.py
└── money_machine.py
├── Coffee Machine
└── main.py
├── Collatz Conjecture
├── collatz.py
└── readme.MD
├── Digital Clock
└── digital_clock.py
├── File Automation
├── main.py
└── readme.md
├── FizzBuzz
└── fizzbuzz.py
├── Game - Guess the number
├── art.py
└── guess_the_number.py
├── Game - Hangman
├── hangman_art.py
├── main_game.py
└── word_list.py
├── Game - Higher Lower
├── art.py
├── game_data.py
└── higher_lower_game.py
├── Game - Quiz
├── data.py
├── main.py
├── question_model.py
├── quiz_brain.py
└── test.py
├── Game - Rock, Paper, Scissors
└── rock_paper_scissors.py
├── Game - Tic-Tac-Toe
└── ttt.py
├── Game - Treasure Island
└── treasure_island.py
├── Game - Turtle Race
└── main.py
├── Game - Turtle Road Crossing
├── car_manager.py
├── main.py
├── player.py
├── requirements.txt
└── scoreboard.py
├── Game - US States
├── .idea
│ ├── inspectionProfiles
│ │ └── profiles_settings.xml
│ ├── misc.xml
│ ├── modules.xml
│ └── us-states-game.iml
├── 50_states.csv
├── blank_states_img.gif
├── main.py
└── states_to_learn.csv
├── Hill Cipher
└── hill_Cipher.py
├── Language-Translate
├── README.md
├── language_translate.py
└── requirements.txt
├── Mail Merge
├── Input
│ ├── Letters
│ │ └── starting_letter.txt
│ └── Names
│ │ └── invited_names.txt
├── Output
│ └── ReadyToSend
│ │ ├── letter_for_Aang.txt
│ │ ├── letter_for_Appa.txt
│ │ ├── letter_for_Katara.txt
│ │ ├── letter_for_Momo.txt
│ │ ├── letter_for_Sokka.txt
│ │ ├── letter_for_Toph.txt
│ │ ├── letter_for_Uncle Iroh.txt
│ │ └── letter_for_Zuko.txt
└── main.py
├── News Reader
└── main.py
├── Password Generator Programs
├── characters.py
├── password_generator_easy.py
├── password_generator_easy_chracters_shuffled.py
└── simple_password_generator.py
├── README.md
├── Script - Convert to Gray Image
├── grayImg.py
├── requirements.txt
└── test.jpg
├── Script - Random Song Player
├── randomSongPlayer.py
└── requirements.txt
├── Temp_Conv
├── readme.md
└── temperature.py
├── Tip Calculator
└── tip_calculator.py
├── Turtle Drawing
├── drawing_a_spirograph.py
├── drawing_a_square.py
├── drawing_different_shapes.py
├── hirst_painting.py
├── image.jpg
└── random_walk.py
├── Weather app
├── main.py
└── requirements.txt
├── contributing.MD
├── french-flash-cards
├── data
│ └── french_words.csv
├── images
│ ├── card_back.png
│ ├── card_front.png
│ ├── right.png
│ └── wrong.png
└── main.py
├── nato-alphabet
├── main.py
└── nato_phonetic_alphabet.csv
└── pdf to text
├── example.pdf
├── new.txt
├── pdfToText.py
└── requirements.txt
/BMI calculator:
--------------------------------------------------------------------------------
1 | height=float(input("Enter your Height in centimeters: "))
2 |
3 | weight=float(input("Enter your Weight in Kg: "))
4 |
5 | height /= 100
6 |
7 | # BMI is Weight/Height^2 and Height is in Metres
8 | bmi=weight/(height*height)
9 |
10 | print("your Body Mass Index is: ",bmi)
11 |
12 | if(bmi>0):
13 | if(bmi <= 16):
14 | print("You are severely underweight")
15 | elif(bmi <= 18.5):
16 | print("You are underweight")
17 | elif(bmi <= 25):
18 | print("You are Healthy")
19 | elif(bmi <= 30):
20 | print("You are overweight")
21 | else: print("You are severely overweight")
22 |
23 | else:("Please enter valid details")
24 |
--------------------------------------------------------------------------------
/Base Converter/base_converter.py:
--------------------------------------------------------------------------------
1 |
2 | """
3 | Convert a number from one base to another.
4 |
5 | This program converts a number from one base to another. The user can
6 | choose the base of the number to be converted and the base to which it
7 | will be converted. The program will then convert the number and display
8 | the result.
9 | """
10 |
11 | def convert_to_base_10(number, base):
12 | """Convert number Or string to base 10."""
13 | digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
14 | base_10 = 0
15 | for digit in number:
16 | base_10 = base_10 * base + digits.index(digit)
17 | return base_10
18 |
19 | def convert_from_base_10(number, base):
20 | """Convert number from base 10."""
21 | digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
22 | new_number = ""
23 | while number > 0:
24 | new_number = digits[number % base] + new_number
25 | number //= base
26 | return new_number
27 |
28 | def get_number():
29 | """Get the number Or string to convert."""
30 | while True:
31 | number = input("Enter the number to convert: ").upper()
32 | if number.isalnum():
33 | return number
34 | print("ERROR: Enter a number or string.")
35 |
36 | def get_base_from():
37 | """Get the base of the number."""
38 | while True:
39 | base_from = input("Enter the base of the number: ")
40 | if base_from.isdigit():
41 | return int(base_from)
42 | print("ERROR: Enter a positive integer.")
43 |
44 | def get_base_to():
45 | """Get the base to convert to."""
46 | while True:
47 | base_to = input("Enter the base to convert to: ")
48 | if base_to.isdigit():
49 | return int(base_to)
50 | print("ERROR: Enter a positive integer.")
51 |
52 | def convert_number(number, base_from, base_to):
53 | """Convert the number."""
54 | # Convert number to base 10.
55 | base_10 = convert_to_base_10(number, base_from)
56 |
57 | # Convert number from base 10.
58 | new_number = convert_from_base_10(base_10, base_to)
59 |
60 | return new_number
61 |
62 | def main():
63 | """Main function."""
64 | # Get the number to convert.
65 | number = get_number()
66 |
67 | # Get the base of the number.
68 | base_from = get_base_from()
69 |
70 | # Get the base to convert to.
71 | base_to = get_base_to()
72 |
73 | # Convert the number.
74 | new_number = convert_number(number, base_from, base_to)
75 |
76 | # Display the result.
77 | print(f"{number} in base {base_from} is {new_number} in base {base_to}.")
78 |
79 | if __name__ == "__main__":
80 | main()
81 |
--------------------------------------------------------------------------------
/Caesar Cipher/art.py:
--------------------------------------------------------------------------------
1 | logo = """
2 | ,adPPYba, ,adPPYYba, ,adPPYba, ,adPPYba, ,adPPYYba, 8b,dPPYba,
3 | a8" "" "" `Y8 a8P_____88 I8[ "" "" `Y8 88P' "Y8
4 | 8b ,adPPPPP88 8PP""""""" `"Y8ba, ,adPPPPP88 88
5 | "8a, ,aa 88, ,88 "8b, ,aa aa ]8I 88, ,88 88
6 | `"Ybbd8"' `"8bbdP"Y8 `"Ybbd8"' `"YbbdP"' `"8bbdP"Y8 88
7 | 88 88
8 | "" 88
9 | 88
10 | ,adPPYba, 88 8b,dPPYba, 88,dPPYba, ,adPPYba, 8b,dPPYba,
11 | a8" "" 88 88P' "8a 88P' "8a a8P_____88 88P' "Y8
12 | 8b 88 88 d8 88 88 8PP""""""" 88
13 | "8a, ,aa 88 88b, ,a8" 88 88 "8b, ,aa 88
14 | `"Ybbd8"' 88 88`YbbdP"' 88 88 `"Ybbd8"' 88
15 | 88
16 | 88
17 | """
--------------------------------------------------------------------------------
/Caesar Cipher/caesar_cipher.py:
--------------------------------------------------------------------------------
1 | from art import logo
2 |
3 |
4 | alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
5 | print(logo)
6 |
7 |
8 | def caesar_cipher(text, shift, direction):
9 | final_result = ''
10 | if direction == 'encode':
11 | check = True
12 | elif direction == 'decode':
13 | check = False
14 | else:
15 | print("Invalid Input")
16 | return
17 |
18 | for letter in text:
19 |
20 | if letter in alphabet:
21 | position = alphabet.index(letter)
22 | if check: new_position = (position + shift)
23 | else: new_position = (position - shift)
24 | final_result += alphabet[new_position]
25 | else: final_result += letter
26 |
27 | print(f"The {direction}d text is {final_result}")
28 |
29 |
30 | while True:
31 | direction = input("Type 'encode' to encrypt, type 'decode' to decrypt: \n")
32 | text = input("Type your message: \n").lower()
33 | shift = int(input("Type the shift value: \n"))
34 | shift = shift % 26
35 | caesar_cipher(text, shift, direction)
36 | choice = input ("Do you want to continue? y/n : ").lower()
37 | if choice == 'y': continue
38 | else:
39 | print('\nGoodbye!')
40 | break
--------------------------------------------------------------------------------
/Calculator/main.py:
--------------------------------------------------------------------------------
1 | from tkinter import *
2 |
3 | me=Tk()
4 | me.geometry("354x460")
5 | me.title("CALCULATOR")
6 | melabel = Label(me,text="CALCULATOR",bg='White',font=("Times",30,'bold'))
7 | melabel.pack(side=TOP)
8 | me.config(background='Dark gray')
9 |
10 | textin=StringVar()
11 | operator=""
12 |
13 | def clickbut(number): #lambda:clickbut(1)
14 | global operator
15 | operator=operator+str(number)
16 | textin.set(operator)
17 |
18 | def equlbut():
19 | global operator
20 | add=str(eval(operator))
21 | textin.set(add)
22 | operator=''
23 | def equlbut():
24 | global operator
25 | sub=str(eval(operator))
26 | textin.set(sub)
27 | operator=''
28 | def equlbut():
29 | global operator
30 | mul=str(eval(operator))
31 | textin.set(mul)
32 | operator=''
33 | def equlbut():
34 | global operator
35 | div=str(eval(operator))
36 | textin.set(div)
37 | operator=''
38 |
39 | def clrbut():
40 | textin.set('')
41 |
42 |
43 | metext=Entry(me,font=("Courier New",12,'bold'),textvar=textin,width=25,bd=5,bg='powder blue')
44 | metext.pack()
45 |
46 | but1=Button(me,padx=14,pady=14,bd=4,bg='white',command=lambda:clickbut(1),text="1",font=("Courier New",16,'bold'))
47 | but1.place(x=10,y=100)
48 |
49 | but2=Button(me,padx=14,pady=14,bd=4,bg='white',command=lambda:clickbut(2),text="2",font=("Courier New",16,'bold'))
50 | but2.place(x=10,y=170)
51 |
52 | but3=Button(me,padx=14,pady=14,bd=4,bg='white',command=lambda:clickbut(3),text="3",font=("Courier New",16,'bold'))
53 | but3.place(x=10,y=240)
54 |
55 | but4=Button(me,padx=14,pady=14,bd=4,bg='white',command=lambda:clickbut(4),text="4",font=("Courier New",16,'bold'))
56 | but4.place(x=75,y=100)
57 |
58 | but5=Button(me,padx=14,pady=14,bd=4,bg='white',command=lambda:clickbut(5),text="5",font=("Courier New",16,'bold'))
59 | but5.place(x=75,y=170)
60 |
61 | but6=Button(me,padx=14,pady=14,bd=4,bg='white',command=lambda:clickbut(6),text="6",font=("Courier New",16,'bold'))
62 | but6.place(x=75,y=240)
63 |
64 | but7=Button(me,padx=14,pady=14,bd=4,bg='white',command=lambda:clickbut(7),text="7",font=("Courier New",16,'bold'))
65 | but7.place(x=140,y=100)
66 |
67 | but8=Button(me,padx=14,pady=14,bd=4,bg='white',command=lambda:clickbut(8),text="8",font=("Courier New",16,'bold'))
68 | but8.place(x=140,y=170)
69 |
70 | but9=Button(me,padx=14,pady=14,bd=4,bg='white',command=lambda:clickbut(9),text="9",font=("Courier New",16,'bold'))
71 | but9.place(x=140,y=240)
72 |
73 | but0=Button(me,padx=14,pady=14,bd=4,bg='white',command=lambda:clickbut(0),text="0",font=("Courier New",16,'bold'))
74 | but0.place(x=10,y=310)
75 |
76 | butdot=Button(me,padx=47,pady=14,bd=4,bg='white',command=lambda:clickbut("."),text=".",font=("Courier New",16,'bold'))
77 | butdot.place(x=75,y=310)
78 |
79 | butpl=Button(me,padx=14,pady=14,bd=4,bg='white',text="+",command=lambda:clickbut("+"),font=("Courier New",16,'bold'))
80 | butpl.place(x=205,y=100)
81 |
82 | butsub=Button(me,padx=14,pady=14,bd=4,bg='white',text="-",command=lambda:clickbut("-"),font=("Courier New",16,'bold'))
83 | butsub.place(x=205,y=170)
84 |
85 | butml=Button(me,padx=14,pady=14,bd=4,bg='white',text="*",command=lambda:clickbut("*"),font=("Courier New",16,'bold'))
86 | butml.place(x=205,y=240)
87 |
88 | butdiv=Button(me,padx=14,pady=14,bd=4,bg='white',text="/",command=lambda:clickbut("/"),font=("Courier New",16,'bold'))
89 | butdiv.place(x=205,y=310)
90 |
91 | butclear=Button(me,padx=14,pady=119,bd=4,bg='white',text="CE",command=clrbut,font=("Courier New",16,'bold'))
92 | butclear.place(x=270,y=100)
93 |
94 | butequal=Button(me,padx=151,pady=14,bd=4,bg='white',command=equlbut,text="=",font=("Courier New",16,'bold'))
95 | butequal.place(x=10,y=380)
96 | me.mainloop()
--------------------------------------------------------------------------------
/Central Park Squirrel Data Analysis/.idea/Central Park Squirrel Data Analysis.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Central Park Squirrel Data Analysis/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Central Park Squirrel Data Analysis/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Central Park Squirrel Data Analysis/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Central Park Squirrel Data Analysis/main.py:
--------------------------------------------------------------------------------
1 | import pandas
2 |
3 | df = pandas.read_csv('2018_Central_Park_Squirrel_Census_-_Squirrel_Data.csv')
4 |
5 | fur_colors = ["Gray", "Cinnamon", "Black"]
6 | counts = []
7 |
8 | for color in fur_colors:
9 | counts.append(len(df[df["Primary Fur Color"] == color]))
10 |
11 | squirrel_data = {
12 | "Fur Color": fur_colors,
13 | "Count": counts
14 | }
15 |
16 | data = pandas.DataFrame(squirrel_data)
17 | data.to_csv('squirrel_count.csv')
18 |
--------------------------------------------------------------------------------
/Central Park Squirrel Data Analysis/squirrel_count.csv:
--------------------------------------------------------------------------------
1 | ,Fur Color,Count
2 | 0,Gray,2473
3 | 1,Cinnamon,392
4 | 2,Black,103
5 |
--------------------------------------------------------------------------------
/Chat-bot/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/Chat-bot/README.md:
--------------------------------------------------------------------------------
1 | 
2 | 
3 |
4 | # Hello-to-CHATBOT
5 | A chatbot is a computer software able to interact with humans using a natural language. They usually rely on machine learning, especially on NLP.
6 |
7 | # ⚙️🛠️Preparing Dependencies:
8 | You’re only going to install the library ChatterBot for now. I recommend creating and using a new Python virtual environment for this purpose. Execute the following commands in your Python terminal:
9 |
10 | run these command:
11 | ```sh
12 | pip install chatterbot
13 | ```
14 | ```sh
15 | pip install chatterbot_corpus
16 | ```
17 |
18 | You can also try upgrading them:
19 | ```sh
20 | pip install --upgrade chatterbot_corpus
21 | ```
22 | ```sh
23 | pip install --upgrade chatterbot
24 | ```
25 | That’s it. We’re ready to go.
26 |
27 | # Communicating with a Bot🤖
28 |
29 | You can communicate with your bot using its method .get_response(). Here’s an example of how that might look like :
30 |
31 |
--------------------------------------------------------------------------------
/Chat-bot/chatbots.py:
--------------------------------------------------------------------------------
1 | from chatterbot import ChatBot
2 | from chatterbot.trainers import ListTrainer
3 | my_bot=ChatBot(
4 | name="PyBot",
5 | read_only=True,
6 | )
7 | logic_adapters=["chatterbot.logic.MathematicalEvaluation","chatterbot.logic.BestMatch"]
8 | small_talk = ['hi there!',
9 | 'hi!',
10 | 'how do you do?',
11 | 'how are you?',
12 | 'i\'m cool.',
13 | 'fine, you?',
14 | 'always cool.',
15 | 'i\'m ok',
16 | 'glad to hear that.',
17 | 'i\'m fine',
18 | 'glad to hear that.',
19 | 'i feel awesome',
20 | 'excellent, glad to hear that.',
21 | 'not so good',
22 | 'sorry to hear that.',
23 | 'what\'s your name?',
24 | 'i\'m pybot. ask me a math question, please.']
25 | math_talk_1 = ['pythagorean theorem',
26 | 'a squared plus b squared equals c squared.']
27 | math_talk_2 = ['law of cosines',
28 | 'c**2 = a**2 + b**2 - 2 * a * b * cos(gamma)']
29 | list_trainer = ListTrainer(my_bot)
30 |
31 | for item in (small_talk, math_talk_1, math_talk_2):
32 | list_trainer.train(item)
33 | corpus_pusirainer(my_bot)
34 | corpus_tainer.train('chatterbot.corpus.english')
35 | print(my_bot.get_response("hi"))
36 | print(my_bot.get_response("Ifell awesome today"))
37 | print(my_bot.get_response("What's your name?"))
38 | print(my_bot.get_response("show me the pythagorean theorem"))
39 | print(my_bot.get_response("do you know the law of cosines?"))
--------------------------------------------------------------------------------
/Chat-bot/requirements.txt:
--------------------------------------------------------------------------------
1 | chatterbot
2 | chatterbot_corpus
3 |
--------------------------------------------------------------------------------
/Coffee Machine - OOP/coffee_maker.py:
--------------------------------------------------------------------------------
1 | class CoffeeMaker:
2 | """Models the machine that makes the coffee"""
3 | def __init__(self):
4 | self.resources = {
5 | "water": 300,
6 | "milk": 200,
7 | "coffee": 100,
8 | }
9 |
10 | def report(self):
11 | """Prints a report of all resources."""
12 | print(f"Water: {self.resources['water']}ml")
13 | print(f"Milk: {self.resources['milk']}ml")
14 | print(f"Coffee: {self.resources['coffee']}g")
15 |
16 | def is_resource_sufficient(self, drink):
17 | """Returns True when order can be made, False if ingredients are insufficient."""
18 | can_make = True
19 | for item in drink.ingredients:
20 | if drink.ingredients[item] > self.resources[item]:
21 | print(f"Sorry there is not enough {item}.")
22 | can_make = False
23 | return can_make
24 |
25 | def make_coffee(self, order):
26 | """Deducts the required ingredients from the resources."""
27 | for item in order.ingredients:
28 | self.resources[item] -= order.ingredients[item]
29 | print(f"Here is your {order.name} ☕️. Enjoy!")
30 |
--------------------------------------------------------------------------------
/Coffee Machine - OOP/main.py:
--------------------------------------------------------------------------------
1 | from menu import Menu
2 | from coffee_maker import CoffeeMaker
3 | from money_machine import MoneyMachine
4 |
5 | menu = Menu()
6 | coffee_maker = CoffeeMaker()
7 | money_machine = MoneyMachine()
8 | is_on = True
9 |
10 | while is_on:
11 | options = menu.get_items()
12 | choice = input(f"What would you like? ({options}): ")
13 | if choice in ['latte', 'cappuccino', 'espresso', 'off', 'report']:
14 | if choice == "off":
15 | print("BAAAAAAAAAAAAIIIIIII")
16 | is_on = False
17 | elif choice == "report":
18 | coffee_maker.report()
19 | money_machine.report()
20 | else:
21 | drink = menu.find_drink(choice)
22 | is_enough_ingredients = coffee_maker.is_resource_sufficient(drink)
23 | is_payment_successful = money_machine.make_payment(drink.cost)
24 | if is_enough_ingredients and is_payment_successful:
25 | coffee_maker.make_coffee(drink)
26 | else:
27 | print("Invalid Choice\n")
28 | continue
29 |
--------------------------------------------------------------------------------
/Coffee Machine - OOP/menu.py:
--------------------------------------------------------------------------------
1 | class MenuItem:
2 | """Models each Menu Item."""
3 | def __init__(self, name, water, milk, coffee, cost):
4 | self.name = name
5 | self.cost = cost
6 | self.ingredients = {
7 | "water": water,
8 | "milk": milk,
9 | "coffee": coffee
10 | }
11 |
12 |
13 | class Menu:
14 | """Models the Menu with drinks."""
15 | def __init__(self):
16 | self.menu = [
17 | MenuItem(name="latte", water=200, milk=150, coffee=24, cost=2.5),
18 | MenuItem(name="espresso", water=50, milk=0, coffee=18, cost=1.5),
19 | MenuItem(name="cappuccino", water=250, milk=50, coffee=24, cost=3),
20 | ]
21 |
22 | def get_items(self):
23 | """Returns all the names of the available menu items"""
24 | options = ""
25 | for item in self.menu:
26 | options += f"{item.name}/"
27 | return options
28 |
29 | def find_drink(self, order_name):
30 | """Searches the menu for a particular drink by name. Returns that item if it exists, otherwise returns None"""
31 | for item in self.menu:
32 | if item.name == order_name:
33 | return item
34 | print("Sorry that item is not available.")
35 |
--------------------------------------------------------------------------------
/Coffee Machine - OOP/money_machine.py:
--------------------------------------------------------------------------------
1 | class MoneyMachine:
2 |
3 | CURRENCY = "$"
4 |
5 | COIN_VALUES = {
6 | "quarters": 0.25,
7 | "dimes": 0.10,
8 | "nickles": 0.05,
9 | "pennies": 0.01
10 | }
11 |
12 | def __init__(self):
13 | self.profit = 0
14 | self.money_received = 0
15 |
16 | def report(self):
17 | """Prints the current profit"""
18 | print(f"Money: {self.CURRENCY}{self.profit}")
19 |
20 | def process_coins(self):
21 | """Returns the total calculated from coins inserted."""
22 | print("Please insert coins.")
23 | for coin in self.COIN_VALUES:
24 | self.money_received += int(input(f"How many {coin}?: ")) * self.COIN_VALUES[coin]
25 | return self.money_received
26 |
27 | def make_payment(self, cost):
28 | """Returns True when payment is accepted, or False if insufficient."""
29 | self.process_coins()
30 | if self.money_received >= cost:
31 | change = round(self.money_received - cost, 2)
32 | print(f"Here is {self.CURRENCY}{change} in change.")
33 | self.profit += cost
34 | self.money_received = 0
35 | return True
36 | else:
37 | print("Sorry that's not enough money. Money refunded.")
38 | self.money_received = 0
39 | return False
40 |
--------------------------------------------------------------------------------
/Coffee Machine/main.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | MENU = {
4 | "espresso": {
5 | "ingredients": {
6 | "water": 50,
7 | "coffee": 18,
8 | },
9 | "cost": 1.5,
10 | },
11 | "latte": {
12 | "ingredients": {
13 | "water": 200,
14 | "milk": 150,
15 | "coffee": 24,
16 | },
17 | "cost": 2.5,
18 | },
19 | "cappuccino": {
20 | "ingredients": {
21 | "water": 250,
22 | "milk": 100,
23 | "coffee": 24,
24 | },
25 | "cost": 3.0,
26 | }
27 | }
28 |
29 | resources = {
30 | "water": 300,
31 | "milk": 200,
32 | "coffee": 100,
33 | }
34 |
35 |
36 | def brew_coffee(item_choice):
37 | """
38 | To make you some Yum Coffee :)
39 | """
40 | for resource in resources:
41 | resources[resource] -= MENU[item_choice]["ingredients"][resource]
42 | print(f"Here's your {item_choice} ☕ Enjoy!\n-----------\n")
43 |
44 |
45 | def check_resources(item_choice):
46 | """
47 | To check if the machine has enough resources to brew your coffee.
48 | """
49 | for resource in resources:
50 | if resources[resource] < MENU[item_choice]["ingredients"][resource]:
51 | return {
52 | "result": False,
53 | "resource": resource
54 | }
55 | return {
56 | "result": True,
57 | "resource": "None",
58 | }
59 |
60 |
61 | def report():
62 | print("Water: ", resources['water'])
63 | print("Milk: ", resources['milk'])
64 | print("Coffee: ", resources['coffee'])
65 | print("Money: $", machine_money)
66 |
67 |
68 | call_turn_off = False
69 | machine_money = 0
70 |
71 | while not call_turn_off:
72 | user_choice = input("What would you like? (espresso/latte/cappuccino): ")
73 |
74 | valid_choices = ['espresso', 'latte', 'cappuccino', 'report', 'off', 'clear']
75 | if user_choice in valid_choices:
76 | if user_choice == 'clear':
77 | os.system("clear")
78 | continue
79 | elif user_choice == 'off':
80 | call_turn_off = True
81 | continue
82 | elif user_choice == 'report':
83 | report()
84 | print("\n-----------\n")
85 | continue
86 |
87 | resource_check = check_resources(user_choice)
88 | if resource_check["result"]:
89 |
90 | print("Please insert coins.")
91 | quarters = int(input("How many quarters?: "))
92 | dimes = int(input("How many dimes?: "))
93 | nickles = int(input("How many nickles?: "))
94 | pennies = int(input("How many pennies?: "))
95 | total_money_input = 0.01 * pennies + 0.05 * nickles + 0.1 * dimes + 0.25 * quarters
96 |
97 | if MENU[user_choice]["cost"] > total_money_input:
98 | print("Sorry, that's not enough money. Money Refunded")
99 | else:
100 | machine_money += total_money_input
101 | if total_money_input > MENU[user_choice]["cost"]:
102 | change = total_money_input - MENU[user_choice]["cost"]
103 | print("Here's ${:.2f} in change.".format(change))
104 | brew_coffee(user_choice)
105 |
106 | else:
107 | missing = resource_check["resource"]
108 | print(f"Sorry, there's not enough {missing}.")
109 | continue
110 | else:
111 | print("Invalid Input\n-----------\n")
112 | continue
113 |
--------------------------------------------------------------------------------
/Collatz Conjecture/collatz.py:
--------------------------------------------------------------------------------
1 | import matplotlib.pyplot as plt
2 |
3 | n = int(input())
4 | num = []
5 | x_axis = []
6 | num.insert(0, n)
7 | while n != 1:
8 | if n % 2 == 0:
9 | n = int(n / 2)
10 | num.append(n)
11 | else:
12 | n = 3 * n + 1
13 | num.append(n)
14 |
15 | print(len(num))
16 | print(num)
17 |
18 | for i in range(1, len(num) + 1):
19 | x_axis.append(i)
20 |
21 | plt.xlabel("STEPS")
22 | plt.ylabel("VALUES")
23 | plt.plot(x_axis, num)
24 |
25 | plt.show()
26 |
27 |
28 | # collatz
29 |
--------------------------------------------------------------------------------
/Collatz Conjecture/readme.MD:
--------------------------------------------------------------------------------
1 | # Collatz-Conjecture
2 |
3 |
4 | ### The Collatz conjecture is a conjecture in mathematics that concerns sequences defined as follows: start with any positive integer n. Then each term is obtained from the previous term as follows: if the previous term is even, the next term is one half of the previous term. If the previous term is odd, the next term is 3 times the previous term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
5 |
6 | #### The above example is for the number (n) : 19907.
7 |
8 | ##### For more information about this conjecture please visit: https://en.wikipedia.org/wiki/Collatz_conjecture
9 | ##### This is a video by a YouTuber called Veritasium which beautifully explains this conjecture: https://youtu.be/094y1Z2wpJg
10 |
--------------------------------------------------------------------------------
/Digital Clock/digital_clock.py:
--------------------------------------------------------------------------------
1 | # importing whole module
2 | from tkinter import *
3 | from tkinter.ttk import *
4 |
5 | # importing strftime function to system time
6 |
7 | from time import strftime
8 |
9 | # creating tkinter window
10 | root = Tk()
11 | root.title('Clock')
12 |
13 | # This function is used to display time on the label
14 | def time():
15 | string = strftime("%H : %M : %S")
16 | lbl.config(text = string)
17 | lbl.after(100, time)
18 |
19 | # Styling the label widget so that clock will look more attractive
20 | lbl = Label(root, font = ('calibri', 40, 'bold'))
21 |
22 | # Placing clock at the centre of the tkinter window
23 | lbl.pack(anchor = 'center')
24 | time()
25 | mainloop()
--------------------------------------------------------------------------------
/File Automation/main.py:
--------------------------------------------------------------------------------
1 | import os
2 | import pathlib
3 | import shutil
4 |
5 | dir_path = "C:/Users/Downloads/"
6 |
7 | file_list = []
8 | executables = []
9 |
10 | for path in os.listdir(dir_path):
11 | if os.path.isfile(os.path.join(dir_path, path)):
12 | file_list.append(path)
13 |
14 | for file in os.listdir(dir_path):
15 | file_extension = pathlib.Path(file).suffix
16 | if (file_extension) == ".exe" or file_extension==".EXE":
17 | path = f"C:/Users/Downloads/{file}"
18 | dest_path = f"C:/Users/Downloads/Executables/{file}"
19 | shutil.move(path, dest_path)
20 | elif (file_extension) == ".pdf":
21 | path = f"C:/Users/Downloads/{file}"
22 | dest_path = f"C:/Users/Downloads/PDFs/"
23 | shutil.move(path, dest_path)
24 | elif (
25 | (file_extension) == ".mp3"
26 | or file_extension == ".mp4"
27 | or file_extension == ".mkv"
28 | ):
29 | path = f"C:/Users/Downloads/{file}"
30 | dest_path = f"C:/Users/Downloads/Media/"
31 | shutil.move(path, dest_path)
32 | elif (
33 | (file_extension) == ".ppt"
34 | or file_extension == ".pptx"
35 | or file_extension == ".pptm"
36 | ):
37 | path = f"C:/Users/Downloads/{file}"
38 | dest_path = f"C:/Users/Downloads/PPTs/"
39 | shutil.move(path, dest_path)
40 | elif (
41 | (file_extension) == ".png"
42 | or file_extension == ".jpg"
43 | or file_extension == ".jpeg"
44 | or file_extension == ".JPG"
45 | or file_extension == ".PNG"
46 | or file_extension == ".JPEG"
47 | ):
48 | path = f"C:/Users/Downloads/{file}"
49 | dest_path = f"C:/Users/Downloads/images/"
50 | shutil.move(path, dest_path)
51 | elif file_extension==".xlsx" or file_extension==".xls" or file_extension==".csv":
52 | path=f"C:/Users/Downloads/{file}"
53 | dest_path = f"C:/Users/Downloads/Spreadsheets/"
54 | shutil.move(path,dest_path)
55 | elif file_extension==".txt" or file_extension==".doc" or file_extension==".docx":
56 | path=f"C:/Users/Downloads/{file}"
57 | dest_path = f"C:/Users/Downloads/Text_Documents/"
58 | shutil.move(path,dest_path)
59 | elif file_extension==".rar" or file_extension==".zip" or file_extension==".tar" or file_extension==".gz":
60 | path=f"C:/Users/Downloads/{file}"
61 | dest_path = f"C:/Users/Downloads/Compressed/"
62 | shutil.move(path,dest_path)
63 | else:
64 | if os.path.isdir(dir_path)!=True:
65 | path=f"C:/Users/Downloads/{file}"
66 | dest_path = f"C:/Users/Downloads/Miscellaneous/"
67 | shutil.move(path,dest_path)
--------------------------------------------------------------------------------
/File Automation/readme.md:
--------------------------------------------------------------------------------
1 | This is a program that arranges your files according to their extension
2 |
--------------------------------------------------------------------------------
/FizzBuzz/fizzbuzz.py:
--------------------------------------------------------------------------------
1 | #Write your code below this row 👇
2 |
3 | for number in range(1,101):
4 | if number % 15 == 0 :
5 | print("FizzBuzz")
6 | elif number % 5 == 0:
7 | print("Buzz")
8 | elif number % 3 == 0 :
9 | print("Fizz")
10 | else: print(number)
11 |
--------------------------------------------------------------------------------
/Game - Guess the number/art.py:
--------------------------------------------------------------------------------
1 | logo = """
2 | / _ \_ _ ___ ___ ___ /__ \ |__ ___ /\ \ \_ _ _ __ ___ | |__ ___ _ __
3 | / /_\/ | | |/ _ \/ __/ __| / /\/ '_ \ / _ \ / \/ / | | | '_ ` _ \| '_ \ / _ \ '__|
4 | / /_\\| |_| | __/\__ \__ \ / / | | | | __/ / /\ /| |_| | | | | | | |_) | __/ |
5 | \____/ \__,_|\___||___/___/ \/ |_| |_|\___| \_\ \/ \__,_|_| |_| |_|_.__/ \___|_|
6 | """
--------------------------------------------------------------------------------
/Game - Guess the number/guess_the_number.py:
--------------------------------------------------------------------------------
1 | #Number Guessing Game
2 | import random
3 | from art import logo
4 |
5 | print(logo)
6 | difficulty = (input("Welcome to the Number Guessing Game!\nI'm thinking of a number between 1 and 100.\nChoose a difficulty. Type 'easy' or 'hard' : "))
7 |
8 | if difficulty== 'easy': no_of_attempts = 10
9 | elif difficulty =='hard': no_of_attempts = 5
10 | else: print('Invalid Input')
11 |
12 | comp_guessed_number = random.randint(1,100)
13 |
14 |
15 | if difficulty == 'easy' or difficulty == 'hard':
16 | print(f"You have {no_of_attempts} attempts remaining to guess the number.")
17 | while no_of_attempts and no_of_attempts > 0:
18 | user_guess = int(input("\nMake a guess: "))
19 |
20 | if user_guess == comp_guessed_number:
21 | print("Congratulations! You made the perfect guess")
22 | break
23 |
24 | no_of_attempts -= 1
25 |
26 | if no_of_attempts > 0:
27 | comp = 'high' if user_guess > comp_guessed_number else 'low'
28 | print(f"Too {comp}.\nGuess again.")
29 | print(f"You have {no_of_attempts} attempts remaining to guess the number.")
30 |
31 | if no_of_attempts == 0:
32 | print('You are out of attempts.\nF')
--------------------------------------------------------------------------------
/Game - Hangman/hangman_art.py:
--------------------------------------------------------------------------------
1 | stages = ['''
2 | +---+
3 | | |
4 | O |
5 | /|\ |
6 | / \ |
7 | |
8 | =========
9 | ''', '''
10 | +---+
11 | | |
12 | O |
13 | /|\ |
14 | / |
15 | |
16 | =========
17 | ''', '''
18 | +---+
19 | | |
20 | O |
21 | /|\ |
22 | |
23 | |
24 | =========
25 | ''', '''
26 | +---+
27 | | |
28 | O |
29 | /| |
30 | |
31 | |
32 | =========''', '''
33 | +---+
34 | | |
35 | O |
36 | | |
37 | |
38 | |
39 | =========
40 | ''', '''
41 | +---+
42 | | |
43 | O |
44 | |
45 | |
46 | |
47 | =========
48 | ''', '''
49 | +---+
50 | | |
51 | |
52 | |
53 | |
54 | |
55 | =========
56 | ''']
57 |
58 | logo = '''
59 | _
60 | | |
61 | | |__ __ _ _ __ __ _ _ __ ___ __ _ _ __
62 | | '_ \ / _` | '_ \ / _` | '_ ` _ \ / _` | '_ \
63 | | | | | (_| | | | | (_| | | | | | | (_| | | | |
64 | |_| |_|\__,_|_| |_|\__, |_| |_| |_|\__,_|_| |_|
65 | __/ |
66 | |___/ '''
67 |
--------------------------------------------------------------------------------
/Game - Hangman/main_game.py:
--------------------------------------------------------------------------------
1 | import os
2 | import random
3 | import word_list as wl
4 | import hangman_art as art
5 | end_of_game = False
6 | lives=6
7 | chosen_word = random.choice(wl.word_list)
8 |
9 | print(f"\n\n {art.logo} \n\n")
10 |
11 | #Create blanks
12 | display = []
13 | for _ in range(len(chosen_word)):
14 | display += "_"
15 |
16 | while not end_of_game:
17 |
18 | guess = input("Guess a letter: ").lower()
19 | os.system('clear')
20 | # clear()
21 | if guess in display:
22 | print(f"You've already guessed {guess}")
23 |
24 | for position in range(len(chosen_word)):
25 | letter = chosen_word[position]
26 |
27 | if letter == guess:
28 | display[position] = letter
29 |
30 | print(f"{' '.join(display)}")
31 | if guess not in chosen_word:
32 | print(f"You guessed {guess}, that's not in the word. You lost 1 life. ")
33 | lives -= 1
34 | print(art.stages[-1*(6-lives) - 1])
35 |
36 | #Check if user has got all letters.
37 | if "_" not in display:
38 | end_of_game = True
39 | print(f"{' '.join(display)}")
40 | print("You win.")
41 | if lives==0:
42 | end_of_game=True
43 |
44 | print("You Lose")
45 |
--------------------------------------------------------------------------------
/Game - Hangman/word_list.py:
--------------------------------------------------------------------------------
1 | word_list = [
2 | 'abruptly',
3 | 'absurd',
4 | 'abyss',
5 | 'affix',
6 | 'askew',
7 | 'avenue',
8 | 'awkward',
9 | 'axiom',
10 | 'azure',
11 | 'bagpipes',
12 | 'bandwagon',
13 | 'banjo',
14 | 'bayou',
15 | 'beekeeper',
16 | 'bikini',
17 | 'blitz',
18 | 'blizzard',
19 | 'boggle',
20 | 'bookworm',
21 | 'boxcar',
22 | 'boxful',
23 | 'buckaroo',
24 | 'buffalo',
25 | 'buffoon',
26 | 'buxom',
27 | 'buzzard',
28 | 'buzzing',
29 | 'buzzwords',
30 | 'caliph',
31 | 'cobweb',
32 | 'cockiness',
33 | 'croquet',
34 | 'crypt',
35 | 'curacao',
36 | 'cycle',
37 | 'daiquiri',
38 | 'dirndl',
39 | 'disavow',
40 | 'dizzying',
41 | 'duplex',
42 | 'dwarves',
43 | 'embezzle',
44 | 'equip',
45 | 'espionage',
46 | 'euouae',
47 | 'exodus',
48 | 'faking',
49 | 'fishhook',
50 | 'fixable',
51 | 'fjord',
52 | 'flapjack',
53 | 'flopping',
54 | 'fluffiness',
55 | 'flyby',
56 | 'foxglove',
57 | 'frazzled',
58 | 'frizzled',
59 | 'fuchsia',
60 | 'funny',
61 | 'gabby',
62 | 'galaxy',
63 | 'galvanize',
64 | 'gazebo',
65 | 'giaour',
66 | 'gizmo',
67 | 'glowworm',
68 | 'glyph',
69 | 'gnarly',
70 | 'gnostic',
71 | 'gossip',
72 | 'grogginess',
73 | 'haiku',
74 | 'haphazard',
75 | 'hyphen',
76 | 'iatrogenic',
77 | 'icebox',
78 | 'injury',
79 | 'ivory',
80 | 'ivy',
81 | 'jackpot',
82 | 'jaundice',
83 | 'jawbreaker',
84 | 'jaywalk',
85 | 'jazziest',
86 | 'jazzy',
87 | 'jelly',
88 | 'jigsaw',
89 | 'jinx',
90 | 'jiujitsu',
91 | 'jockey',
92 | 'jogging',
93 | 'joking',
94 | 'jovial',
95 | 'joyful',
96 | 'juicy',
97 | 'jukebox',
98 | 'jumbo',
99 | 'kayak',
100 | 'kazoo',
101 | 'keyhole',
102 | 'khaki',
103 | 'kilobyte',
104 | 'kiosk',
105 | 'kitsch',
106 | 'kiwifruit',
107 | 'klutz',
108 | 'knapsack',
109 | 'larynx',
110 | 'lengths',
111 | 'lucky',
112 | 'luxury',
113 | 'lymph',
114 | 'marquis',
115 | 'matrix',
116 | 'megahertz',
117 | 'microwave',
118 | 'mnemonic',
119 | 'mystify',
120 | 'naphtha',
121 | 'nightclub',
122 | 'nowadays',
123 | 'numbskull',
124 | 'nymph',
125 | 'onyx',
126 | 'ovary',
127 | 'oxidize',
128 | 'oxygen',
129 | 'pajama',
130 | 'peekaboo',
131 | 'phlegm',
132 | 'pixel',
133 | 'pizazz',
134 | 'pneumonia',
135 | 'polka',
136 | 'pshaw',
137 | 'psyche',
138 | 'puppy',
139 | 'puzzling',
140 | 'quartz',
141 | 'queue',
142 | 'quips',
143 | 'quixotic',
144 | 'quiz',
145 | 'quizzes',
146 | 'quorum',
147 | 'razzmatazz',
148 | 'rhubarb',
149 | 'rhythm',
150 | 'rickshaw',
151 | 'schnapps',
152 | 'scratch',
153 | 'shiv',
154 | 'snazzy',
155 | 'sphinx',
156 | 'spritz',
157 | 'squawk',
158 | 'staff',
159 | 'strength',
160 | 'strengths',
161 | 'stretch',
162 | 'stronghold',
163 | 'stymied',
164 | 'subway',
165 | 'swivel',
166 | 'syndrome',
167 | 'thriftless',
168 | 'thumbscrew',
169 | 'topaz',
170 | 'transcript',
171 | 'transgress',
172 | 'transplant',
173 | 'triphthong',
174 | 'twelfth',
175 | 'twelfths',
176 | 'unknown',
177 | 'unworthy',
178 | 'unzip',
179 | 'uptown',
180 | 'vaporize',
181 | 'vixen',
182 | 'vodka',
183 | 'voodoo',
184 | 'vortex',
185 | 'voyeurism',
186 | 'walkway',
187 | 'waltz',
188 | 'wave',
189 | 'wavy',
190 | 'waxy',
191 | 'wellspring',
192 | 'wheezy',
193 | 'whiskey',
194 | 'whizzing',
195 | 'whomever',
196 | 'wimpy',
197 | 'witchcraft',
198 | 'wizard',
199 | 'woozy',
200 | 'wristwatch',
201 | 'wyvern',
202 | 'xylophone',
203 | 'yachtsman',
204 | 'yippee',
205 | 'yoked',
206 | 'youthful',
207 | 'yummy',
208 | 'zephyr',
209 | 'zigzag',
210 | 'zigzagging',
211 | 'zilch',
212 | 'zipper',
213 | 'zodiac',
214 | 'zombie',
215 | ]
--------------------------------------------------------------------------------
/Game - Higher Lower/art.py:
--------------------------------------------------------------------------------
1 | logo = """
2 | __ ___ __
3 | / / / (_)___ _/ /_ ___ _____
4 | / /_/ / / __ `/ __ \/ _ \/ ___/
5 | / __ / / /_/ / / / / __/ /
6 | /_/ ///_/\__, /_/ /_/\___/_/
7 | / / /____/_ _____ _____
8 | / / / __ \ | /| / / _ \/ ___/
9 | / /___/ /_/ / |/ |/ / __/ /
10 | /_____/\____/|__/|__/\___/_/
11 | """
12 |
13 | vs = """
14 | _ __
15 | | | / /____
16 | | | / / ___/
17 | | |/ (__ )
18 | |___/____(_)
19 | """
--------------------------------------------------------------------------------
/Game - Higher Lower/game_data.py:
--------------------------------------------------------------------------------
1 | data = [
2 | {
3 | 'name': 'Instagram',
4 | 'follower_count': 346,
5 | 'description': 'Social media platform',
6 | 'country': 'United States'
7 | },
8 | {
9 | 'name': 'Cristiano Ronaldo',
10 | 'follower_count': 215,
11 | 'description': 'Footballer',
12 | 'country': 'Portugal'
13 | },
14 | {
15 | 'name': 'Ariana Grande',
16 | 'follower_count': 183,
17 | 'description': 'Musician and actress',
18 | 'country': 'United States'
19 | },
20 | {
21 | 'name': 'Dwayne Johnson',
22 | 'follower_count': 181,
23 | 'description': 'Actor and professional wrestler',
24 | 'country': 'United States'
25 | },
26 | {
27 | 'name': 'Selena Gomez',
28 | 'follower_count': 174,
29 | 'description': 'Musician and actress',
30 | 'country': 'United States'
31 | },
32 | {
33 | 'name': 'Kylie Jenner',
34 | 'follower_count': 172,
35 | 'description': 'Reality TV personality and businesswoman and Self-Made Billionaire',
36 | 'country': 'United States'
37 | },
38 | {
39 | 'name': 'Kim Kardashian',
40 | 'follower_count': 167,
41 | 'description': 'Reality TV personality and businesswoman',
42 | 'country': 'United States'
43 | },
44 | {
45 | 'name': 'Lionel Messi',
46 | 'follower_count': 149,
47 | 'description': 'Footballer',
48 | 'country': 'Argentina'
49 | },
50 | {
51 | 'name': 'Beyoncé',
52 | 'follower_count': 145,
53 | 'description': 'Musician',
54 | 'country': 'United States'
55 | },
56 | {
57 | 'name': 'Neymar',
58 | 'follower_count': 138,
59 | 'description': 'Footballer',
60 | 'country': 'Brasil'
61 | },
62 | {
63 | 'name': 'National Geographic',
64 | 'follower_count': 135,
65 | 'description': 'Magazine',
66 | 'country': 'United States'
67 | },
68 | {
69 | 'name': 'Justin Bieber',
70 | 'follower_count': 133,
71 | 'description': 'Musician',
72 | 'country': 'Canada'
73 | },
74 | {
75 | 'name': 'Taylor Swift',
76 | 'follower_count': 131,
77 | 'description': 'Musician',
78 | 'country': 'United States'
79 | },
80 | {
81 | 'name': 'Kendall Jenner',
82 | 'follower_count': 127,
83 | 'description': 'Reality TV personality and Model',
84 | 'country': 'United States'
85 | },
86 | {
87 | 'name': 'Jennifer Lopez',
88 | 'follower_count': 119,
89 | 'description': 'Musician and actress',
90 | 'country': 'United States'
91 | },
92 | {
93 | 'name': 'Nicki Minaj',
94 | 'follower_count': 113,
95 | 'description': 'Musician',
96 | 'country': 'Trinidad and Tobago'
97 | },
98 | {
99 | 'name': 'Nike',
100 | 'follower_count': 109,
101 | 'description': 'Sportswear multinational',
102 | 'country': 'United States'
103 | },
104 | {
105 | 'name': 'Khloé Kardashian',
106 | 'follower_count': 108,
107 | 'description': 'Reality TV personality and businesswoman',
108 | 'country': 'United States'
109 | },
110 | {
111 | 'name': 'Miley Cyrus',
112 | 'follower_count': 107,
113 | 'description': 'Musician and actress',
114 | 'country': 'United States'
115 | },
116 | {
117 | 'name': 'Katy Perry',
118 | 'follower_count': 94,
119 | 'description': 'Musician',
120 | 'country': 'United States'
121 | },
122 | {
123 | 'name': 'Kourtney Kardashian',
124 | 'follower_count': 90,
125 | 'description': 'Reality TV personality',
126 | 'country': 'United States'
127 | },
128 | {
129 | 'name': 'Kevin Hart',
130 | 'follower_count': 89,
131 | 'description': 'Comedian and actor',
132 | 'country': 'United States'
133 | },
134 | {
135 | 'name': 'Ellen DeGeneres',
136 | 'follower_count': 87,
137 | 'description': 'Comedian',
138 | 'country': 'United States'
139 | },
140 | {
141 | 'name': 'Real Madrid CF',
142 | 'follower_count': 86,
143 | 'description': 'Football club',
144 | 'country': 'Spain'
145 | },
146 | {
147 | 'name': 'FC Barcelona',
148 | 'follower_count': 85,
149 | 'description': 'Football club',
150 | 'country': 'Spain'
151 | },
152 | {
153 | 'name': 'Rihanna',
154 | 'follower_count': 81,
155 | 'description': 'Musician and businesswoman',
156 | 'country': 'Barbados'
157 | },
158 | {
159 | 'name': 'Demi Lovato',
160 | 'follower_count': 80,
161 | 'description': 'Musician and actress',
162 | 'country': 'United States'
163 | },
164 | {
165 | 'name': "Victoria's Secret",
166 | 'follower_count': 69,
167 | 'description': 'Lingerie brand',
168 | 'country': 'United States'
169 | },
170 | {
171 | 'name': 'Zendaya',
172 | 'follower_count': 68,
173 | 'description': 'Actress and musician',
174 | 'country': 'United States'
175 | },
176 | {
177 | 'name': 'Shakira',
178 | 'follower_count': 66,
179 | 'description': 'Musician',
180 | 'country': 'Colombia'
181 | },
182 | {
183 | 'name': 'Drake',
184 | 'follower_count': 65,
185 | 'description': 'Musician',
186 | 'country': 'Canada'
187 | },
188 | {
189 | 'name': 'Chris Brown',
190 | 'follower_count': 64,
191 | 'description': 'Musician',
192 | 'country': 'United States'
193 | },
194 | {
195 | 'name': 'LeBron James',
196 | 'follower_count': 63,
197 | 'description': 'Basketball player',
198 | 'country': 'United States'
199 | },
200 | {
201 | 'name': 'Vin Diesel',
202 | 'follower_count': 62,
203 | 'description': 'Actor',
204 | 'country': 'United States'
205 | },
206 | {
207 | 'name': 'Cardi B',
208 | 'follower_count': 67,
209 | 'description': 'Musician',
210 | 'country': 'United States'
211 | },
212 | {
213 | 'name': 'David Beckham',
214 | 'follower_count': 82,
215 | 'description': 'Footballer',
216 | 'country': 'United Kingdom'
217 | },
218 | {
219 | 'name': 'Billie Eilish',
220 | 'follower_count': 61,
221 | 'description': 'Musician',
222 | 'country': 'United States'
223 | },
224 | {
225 | 'name': 'Justin Timberlake',
226 | 'follower_count': 59,
227 | 'description': 'Musician and actor',
228 | 'country': 'United States'
229 | },
230 | {
231 | 'name': 'UEFA Champions League',
232 | 'follower_count': 58,
233 | 'description': 'Club football competition',
234 | 'country': 'Europe'
235 | },
236 | {
237 | 'name': 'NASA',
238 | 'follower_count': 56,
239 | 'description': 'Space agency',
240 | 'country': 'United States'
241 | },
242 | {
243 | 'name': 'Emma Watson',
244 | 'follower_count': 56,
245 | 'description': 'Actress',
246 | 'country': 'United Kingdom'
247 | },
248 | {
249 | 'name': 'Shawn Mendes',
250 | 'follower_count': 57,
251 | 'description': 'Musician',
252 | 'country': 'Canada'
253 | },
254 | {
255 | 'name': 'Virat Kohli',
256 | 'follower_count': 55,
257 | 'description': 'Cricketer',
258 | 'country': 'India'
259 | },
260 | {
261 | 'name': 'Gigi Hadid',
262 | 'follower_count': 54,
263 | 'description': 'Model',
264 | 'country': 'United States'
265 | },
266 | {
267 | 'name': 'Priyanka Chopra Jonas',
268 | 'follower_count': 53,
269 | 'description': 'Actress and musician',
270 | 'country': 'India'
271 | },
272 | {
273 | 'name': '9GAG',
274 | 'follower_count': 52,
275 | 'description': 'Social media platform',
276 | 'country': 'China'
277 | },
278 | {
279 | 'name': 'Ronaldinho',
280 | 'follower_count': 51,
281 | 'description': 'Footballer',
282 | 'country': 'Brasil'
283 | },
284 | {
285 | 'name': 'Maluma',
286 | 'follower_count': 50,
287 | 'description': 'Musician',
288 | 'country': 'Colombia'
289 | },
290 | {
291 | 'name': 'Camila Cabello',
292 | 'follower_count': 49,
293 | 'description': 'Musician',
294 | 'country': 'Cuba'
295 | },
296 | {
297 | 'name': 'NBA',
298 | 'follower_count': 47,
299 | 'description': 'Club Basketball Competition',
300 | 'country': 'United States'
301 | }
302 | ]
303 |
--------------------------------------------------------------------------------
/Game - Higher Lower/higher_lower_game.py:
--------------------------------------------------------------------------------
1 | from game_data import data
2 | from art import logo, vs
3 | import os
4 | import random
5 |
6 | def compare(choice_1, choice_2, user_choice):
7 | '''
8 | Make comparisons based on choice and return if your answer was correct.
9 | '''
10 | if user_choice == 'A':
11 | if choice_1['follower_count'] < choice_2['follower_count']: return False
12 | else: return True
13 | else:
14 | if choice_1['follower_count'] < choice_2['follower_count']: return True
15 | else: return False
16 |
17 | score = 0
18 | while True:
19 | print(logo)
20 | choice_1 = random.sample(data, 2)[0]
21 | choice_2 = random.sample(data, 2)[1]
22 | if score >0:
23 | print(f"You're right! Current Score: {score}")
24 | print(f"Compare A: {choice_1['name']}, a {choice_1['description']} from {choice_1['country']}")
25 |
26 | print(f"\n{vs}\n")
27 |
28 | print(f"Against B: {choice_2['name']}, a {choice_2['description']} from {choice_2['country']}")
29 |
30 | user_choice = input("Who has more followers? Type 'A' or 'B': ")
31 |
32 | if user_choice == 'A' or user_choice == 'B':
33 | result = compare(choice_1, choice_2, user_choice)
34 |
35 | if not result:
36 | os.system('clear')
37 | print(logo)
38 | print(f"\nSorry, that's wrong. Final Score: {score}")
39 | break
40 | else:
41 | score += 1
42 | os.system('clear')
43 | else:
44 | print('Invalid Input')
45 | break
46 |
--------------------------------------------------------------------------------
/Game - Quiz/data.py:
--------------------------------------------------------------------------------
1 | import requests
2 |
3 | url = 'https://opentdb.com/api.php?amount=10&difficulty=medium&type=boolean'
4 |
5 | response = requests.get(url=url)
6 |
7 | data = response.json()['results']
8 |
9 | question_data = data
10 |
--------------------------------------------------------------------------------
/Game - Quiz/main.py:
--------------------------------------------------------------------------------
1 | from question_model import Question
2 | from data import question_data
3 | from quiz_brain import QuizBrain
4 |
5 | question_bank = []
6 | for question in question_data:
7 | question_bank.append(
8 | Question(question["question"], question["correct_answer"][0]))
9 |
10 | quiz = QuizBrain(question_bank)
11 |
12 | while quiz.still_has_questions():
13 | quiz.next_question()
14 |
15 | print("You've completed the quiz")
16 | print(f"Your final score was: {quiz.score}/{quiz.question_number}")
17 |
--------------------------------------------------------------------------------
/Game - Quiz/question_model.py:
--------------------------------------------------------------------------------
1 | class Question:
2 | def __init__(self, q_text, q_answer):
3 | self.text = q_text
4 | self.answer = q_answer
5 |
--------------------------------------------------------------------------------
/Game - Quiz/quiz_brain.py:
--------------------------------------------------------------------------------
1 | import random
2 |
3 |
4 | class QuizBrain:
5 | def __init__(self, questions_list):
6 | self.question_number = 0
7 | self.questions_list = questions_list
8 | self.score = 0
9 |
10 | def still_has_questions(self):
11 | return self.question_number < len(self.questions_list)
12 |
13 | def next_question(self):
14 | self.check_answer(self.questions_list[self.question_number].answer, input(
15 | f"Q.{self.question_number+1} {self.questions_list[self.question_number].text} (T / F) ?"))
16 | self.question_number += 1
17 |
18 | def check_answer(self, correct_answer, user_answer):
19 | if user_answer.lower() == correct_answer.lower():
20 | self.score += 1
21 | print("You got it right!")
22 | else:
23 | print("That's wrong.")
24 | print(f"The correct answer was: {correct_answer}.")
25 | print(f"Your current score is: {self.score}/{self.question_number+1}")
26 | print("\n")
27 |
--------------------------------------------------------------------------------
/Game - Quiz/test.py:
--------------------------------------------------------------------------------
1 | import requests
2 |
3 | url = 'https://opentdb.com/api.php?amount=10&difficulty=medium&type=boolean'
4 |
5 | response = requests.get(url=url)
6 |
7 | data = response.json()
8 | print(data['results'])
9 |
--------------------------------------------------------------------------------
/Game - Rock, Paper, Scissors/rock_paper_scissors.py:
--------------------------------------------------------------------------------
1 | #Rock Paper Scissors with ASCII Art Python
2 | #Use of random library and its functions
3 |
4 | import random
5 |
6 | rock = '''
7 | _______
8 | ---' ____)
9 | (_____)
10 | (_____)
11 | (____)
12 | ---.__(___)
13 | '''
14 |
15 | paper = '''
16 | _______
17 | ---' ____)____
18 | ______)
19 | _______)
20 | _______)
21 | ---.__________)
22 | '''
23 |
24 | scissors = '''
25 | _______
26 | ---' ____)____
27 | ______)
28 | __________)
29 | (____)
30 | ---.__(___)
31 | '''
32 |
33 |
34 | game_options = [rock, paper, scissors] #All Choices
35 |
36 | choice = int(input('What do you choose? Type 0 for rock, 1 for Paper or 2 for Scissors.\n'))
37 | if choice not in range(0,3):
38 | print("Invalid Input")
39 | else:
40 | print(game_options[choice])
41 | ai_choice = random.randint(0,2)
42 | print(game_options[ai_choice])
43 |
44 |
45 | #Making a pair of user choice and AI choice for comparisons
46 | current_combination = [choice, ai_choice]
47 |
48 |
49 | #Winning Pairs, the only cases in which a user can win
50 | winning_combinations = [[0,2], [1,0], [2,1]]
51 |
52 | #It's a draw if both have the same choice.
53 | #Compare the current pair with winning combination for result
54 | if choice==ai_choice: print("It's a Draw. ")
55 | else:
56 | if current_combination in winning_combinations: print("You Win.")
57 | else: print("You Lose.")
58 |
59 |
--------------------------------------------------------------------------------
/Game - Tic-Tac-Toe/ttt.py:
--------------------------------------------------------------------------------
1 | import random
2 |
3 |
4 | def printBoard(b):
5 | for i in range(9):
6 | if i % 3 == 0:
7 | if i > 0:
8 | print("")
9 | print("|", end="")
10 |
11 | print("{}|".format(b[i]), end="")
12 |
13 | print("")
14 |
15 |
16 | def getUserInput():
17 | try:
18 | n = int(input("Enter the position you want to enter X into(1-9): "))
19 | if n > 0 and n < 10:
20 | return n - 1
21 | else:
22 | return getUserInput()
23 | except ValueError:
24 | return getUserInput()
25 |
26 |
27 | def enterBotInput():
28 | n = random.randrange(1, 9, 1) - 1
29 | return n
30 |
31 |
32 | def WinnerExists(board):
33 | winner = 0
34 |
35 | for i in range(3):
36 | if board[3 * i] == board[3 * i + 1] and board[3 * i + 1] == board[3 * i + 2] and board[3 * i] != " ":
37 | if board[3 * i] == "X":
38 | winner = 1
39 | break
40 | elif board[3 * i] == "O":
41 | winner = 2
42 | break
43 | if board[i] == board[3 + i] and board[3 + i] == board[6 + i] and board[i] != " ":
44 | if board[i] == "X":
45 | winner = 1
46 | break
47 | elif board[i] == "O":
48 | winner = 2
49 | break
50 | if board[0] == board[4] and board[4] == board[8] and board[0] != " ":
51 | if board[0] == "X":
52 | winner = 1
53 | elif board[0] == "O":
54 | winner = 2
55 | if board[2] == board[4] and board[4] == board[6] and board[2] != " ":
56 | if board[2] == "X":
57 | winner = 1
58 | elif board[2] == "O":
59 | winner = 2
60 |
61 | return winner
62 |
63 |
64 | def gameSequence():
65 | board = [" ", " ", " ", " ", " ", " ", " ", " ", " "]
66 |
67 | used = []
68 |
69 | # printBoard(board)
70 |
71 | for i in range(9):
72 | if i % 2 == 0:
73 | printBoard(board)
74 |
75 | winner = WinnerExists(board)
76 |
77 | if winner > 0:
78 | break
79 |
80 | if i % 2 == 0:
81 | n = getUserInput()
82 |
83 | while n in used:
84 | print("{} has already been occupied!".format(n))
85 | n = getUserInput()
86 |
87 | used.append(n)
88 | board[n] = "X"
89 | else:
90 | n = enterBotInput()
91 |
92 | while n in used:
93 | n = enterBotInput()
94 |
95 | used.append(n)
96 | board[n] = "O"
97 |
98 | if len(used) == 9:
99 | printBoard(board)
100 |
101 | winner = WinnerExists(board)
102 |
103 | if winner > 0:
104 | if winner == 1:
105 | print("You won!!!!")
106 | else:
107 | print("You lost!!!!")
108 | else:
109 | print("It's a draw!!!")
110 |
111 | choice = input("Do you want to play again(Y/N): ")
112 |
113 | if choice == "Y" or choice == "y" or choice == "yes":
114 | gameSequence()
115 | else:
116 | return
117 |
118 |
119 | if __name__ == "__main__":
120 | gameSequence()
121 |
--------------------------------------------------------------------------------
/Game - Treasure Island/treasure_island.py:
--------------------------------------------------------------------------------
1 | #Treasure Island Game
2 | #Basic Use of if-else conditionals.
3 |
4 |
5 | print('''
6 | *******************************************************************************
7 | | | | |
8 | _________|________________.=""_;=.______________|_____________________|_______
9 | | | ,-"_,="" `"=.| |
10 | |___________________|__"=._o`"-._ `"=.______________|___________________
11 | | `"=._o`"=._ _`"=._ |
12 | _________|_____________________:=._o "=._."_.-="'"=.__________________|_______
13 | | | __.--" , ; `"=._o." ,-"""-._ ". |
14 | |___________________|_._" ,. .` ` `` , `"-._"-._ ". '__|___________________
15 | | |o`"=._` , "` `; .". , "-._"-._; ; |
16 | _________|___________| ;`-.o`"=._; ." ` '`."\` . "-._ /_______________|_______
17 | | | |o; `"-.o`"=._`` '` " ,__.--o; |
18 | |___________________|_| ; (#) `-.o `"=.`_.--"_o.-; ;___|___________________
19 | ____/______/______/___|o;._ " `".o|o_.--" ;o;____/______/______/____
20 | /______/______/______/_"=._o--._ ; | ; ; ;/______/______/______/_
21 | ____/______/______/______/__"=._o--._ ;o|o; _._;o;____/______/______/____
22 | /______/______/______/______/____"=._o._; | ;_.--"o.--"_/______/______/______/_
23 | ____/______/______/______/______/_____"=.o|o_.--""___/______/______/______/____
24 | /______/______/______/______/______/______/______/______/______/______/_____ /
25 | *******************************************************************************
26 | ''')
27 | print("Welcome to Treasure Island.")
28 | print("Your mission is to find the treasure.")
29 |
30 | first_choice = input('''You're at a cross road. Where do you want to go? Type "left" or "right" to choose.\n''')
31 |
32 |
33 | while True:
34 | if first_choice == "left":
35 | second_choice = input('''\n-----------------------------\nYou come to a lake. There is an island in the middle of the lake. Type "wait" to wait for a boat. Type "swim" to swim across.\n''')
36 | if second_choice == "wait":
37 | third_choice=input('''\n-----------------------------\nYou arrive at the island unharmed. There is a house with 3 doors. One red, one yellow and one blue. Which color do you choose?\n''')
38 | if third_choice=="red":
39 | print("You were burned by fire. Game Over.")
40 | break
41 | elif third_choice=="blue":
42 | print("You were eaten by beasts. Game Over. They had a good dinner though.")
43 | break
44 | elif third_choice=="yellow":
45 | print("You found the treasure chest! You Win!")
46 | break
47 | else:
48 | print("Game Over.")
49 | break
50 | else:
51 | print('You were attacked by a trout. Game Over. ')
52 | break
53 | else:
54 | print('You fell into a hole. Game Over.')
55 | break
56 |
--------------------------------------------------------------------------------
/Game - Turtle Race/main.py:
--------------------------------------------------------------------------------
1 | from turtle import Turtle, Screen
2 | import random
3 |
4 | is_race_on = False
5 | screen = Screen()
6 | screen.colormode(255)
7 | screen.setup(width=800, height=600)
8 |
9 | colors = ["red", "orange", "yellow", "green", "blue", "purple"]
10 | turtles = []
11 |
12 | user_choice = (screen.textinput(
13 | title="Make your bet", prompt="Which turtle will win the race? Choose a color: ")).lower()
14 |
15 |
16 | for i in range(0, 6):
17 | turtles.append(Turtle(shape="turtle"))
18 | turtles[i].color(colors[i])
19 | turtles[i].penup()
20 | turtles[i].goto(x=-380, y=(5-2*i)*25)
21 |
22 | if user_choice in colors:
23 | is_race_on = True
24 |
25 | while is_race_on:
26 | for turtle in turtles:
27 | if turtle.xcor() > 370:
28 | is_race_on = False
29 | winner = turtle.pencolor()
30 | if winner == user_choice:
31 | print(
32 | f"You've won! The {winner.title()} turtle is the winner!")
33 | else:
34 | print(
35 | f"You've lost! The {winner.title()} turtle is the winner!")
36 | random_distance = random.randint(10, 20)
37 | turtle.forward(random_distance)
38 |
39 |
40 | screen.exitonclick()
41 |
--------------------------------------------------------------------------------
/Game - Turtle Road Crossing/car_manager.py:
--------------------------------------------------------------------------------
1 | from turtle import Turtle
2 | import random
3 |
4 | COLORS = ["red", "orange", "yellow", "green", "blue", "purple"]
5 | STARTING_MOVE_DISTANCE = 5
6 | MOVE_INCREMENT = 10
7 |
8 | class CarManager():
9 | def __init__(self):
10 | self.cars = []
11 | self.car_speed = STARTING_MOVE_DISTANCE
12 |
13 | def create_car(self):
14 | if random.randint(1, 6) in [1]:
15 | car = Turtle(shape="square")
16 | car.pu()
17 | car.color(random.choice(COLORS))
18 | car.shapesize(stretch_len=2, stretch_wid=1)
19 | car.goto(x=300, y=random.randint(-250, 250))
20 | self.cars.append(car)
21 |
22 | def go_left(self):
23 | for car in self.cars:
24 | car.goto(x=(car.xcor()-self.car_speed), y=car.ycor()) # Place car at random start point
25 |
26 | def level_up(self):
27 | self.car_speed += MOVE_INCREMENT # Increase car speed
--------------------------------------------------------------------------------
/Game - Turtle Road Crossing/main.py:
--------------------------------------------------------------------------------
1 | from turtle import Screen
2 | from player import Player
3 | from car_manager import CarManager
4 | from scoreboard import Scoreboard
5 | import time
6 |
7 | screen = Screen()
8 | screen.setup(height=600, width=600)
9 | screen.tracer(0)
10 | player = Player()
11 | screen.listen()
12 | screen.onkeypress(fun=player.move, key="Up")
13 |
14 | car_manager = CarManager()
15 | scoreboard = Scoreboard()
16 |
17 | car_speed = 0.1
18 | is_game_on = True
19 | while is_game_on:
20 | time.sleep(car_speed)
21 | screen.update()
22 |
23 | ###Creating new cars
24 | car_manager.create_car()
25 |
26 | ###Moving cars
27 | car_manager.go_left()
28 |
29 | ###Detecting car crash
30 | for car in car_manager.cars:
31 | if player.distance(car)<20:
32 | scoreboard.game_over()
33 | is_game_on = False
34 |
35 | ###Detecting if player crossed finish line
36 | if player.ycor() > 280:
37 | player.go_to_start()
38 | scoreboard.increase_level()
39 | #car_manager.level_up()
40 | car_speed *= 0.8
41 |
42 | screen.exitonclick()
--------------------------------------------------------------------------------
/Game - Turtle Road Crossing/player.py:
--------------------------------------------------------------------------------
1 | from turtle import Turtle
2 |
3 | STARTING_POSITION = (0,-280)
4 | MOVE_DISTANCE = 10
5 | FINISH_LINE_Y = 280
6 |
7 | class Player(Turtle):
8 | def __init__(self):
9 | super().__init__()
10 | self.shape("turtle")
11 | self.pu()
12 | self.seth(90)
13 | self.go_to_start()
14 |
15 | def move(self):
16 | self.fd(MOVE_DISTANCE) # Move turtle a set amount when function is called
17 |
18 | def go_to_start(self):
19 | self.goto(STARTING_POSITION) # Reset turtle position to start
--------------------------------------------------------------------------------
/Game - Turtle Road Crossing/requirements.txt:
--------------------------------------------------------------------------------
1 | turtle
--------------------------------------------------------------------------------
/Game - Turtle Road Crossing/scoreboard.py:
--------------------------------------------------------------------------------
1 | from turtle import Turtle
2 |
3 | FONT = ("Courier", 18, "bold")
4 |
5 | class Scoreboard(Turtle):
6 | def __init__(self):
7 | super().__init__()
8 | self.ht()
9 | self.pu()
10 | self.level = 1
11 | self.goto(x=-235, y=270)
12 | self.update_score()
13 |
14 | def update_score(self):
15 | self.clear() # Clear scoreboard
16 | self.write(f"Level: {self.level}", align="center", font=FONT) # Write new level
17 |
18 | def increase_level(self):
19 | self.level += 1 # Increase level by 1
20 | self.update_score() # Update scoreboard by calling function
21 |
22 | def game_over(self):
23 | self.home()
24 | self.write("GAME OVER.", align="center", font=FONT) # Display game over once game ends
--------------------------------------------------------------------------------
/Game - US States/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Game - US States/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Game - US States/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Game - US States/.idea/us-states-game.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Game - US States/50_states.csv:
--------------------------------------------------------------------------------
1 | state,x,y
2 | Alabama,139,-77
3 | Alaska,-204,-170
4 | Arizona,-203,-40
5 | Arkansas,57,-53
6 | California,-297,13
7 | Colorado,-112,20
8 | Connecticut,297,96
9 | Delaware,275,42
10 | Florida,220,-145
11 | Georgia,182,-75
12 | Hawaii,-317,-143
13 | Idaho,-216,122
14 | Illinois,95,37
15 | Indiana,133,39
16 | Iowa,38,65
17 | Kansas,-17,5
18 | Kentucky,149,1
19 | Louisiana,59,-114
20 | Maine,319,164
21 | Maryland,288,27
22 | Massachusetts,312,112
23 | Michigan,148,101
24 | Minnesota,23,135
25 | Mississippi,94,-78
26 | Missouri,49,6
27 | Montana,-141,150
28 | Nebraska,-61,66
29 | Nevada,-257,56
30 | New Hampshire,302,127
31 | New Jersey,282,65
32 | New Mexico,-128,-43
33 | New York,236,104
34 | North Carolina,239,-22
35 | North Dakota,-44,158
36 | Ohio,176,52
37 | Oklahoma,-8,-41
38 | Oregon,-278,138
39 | Pennsylvania,238,72
40 | Rhode Island,318,94
41 | South Carolina,218,-51
42 | South Dakota,-44,109
43 | Tennessee,131,-34
44 | Texas,-38,-106
45 | Utah,-189,34
46 | Vermont,282,154
47 | Virginia,234,12
48 | Washington,-257,193
49 | West Virginia,200,20
50 | Wisconsin,83,113
51 | Wyoming,-134,90
--------------------------------------------------------------------------------
/Game - US States/blank_states_img.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sreekeshiyer/python-beginner-mini-projects/7566bc4ea14d566034ed76fa16318494d6c6ec13/Game - US States/blank_states_img.gif
--------------------------------------------------------------------------------
/Game - US States/main.py:
--------------------------------------------------------------------------------
1 | import turtle
2 | import pandas as pd
3 |
4 | screen = turtle.Screen()
5 | screen.title("U.S. States Game")
6 | image = "blank_states_img.gif"
7 | screen.addshape(image)
8 | turtle.shape(image)
9 |
10 | df = pd.read_csv("50_states.csv")
11 | states_list = df["state"].to_list()
12 |
13 | guessed_states = []
14 |
15 | while len(guessed_states) < 50:
16 | title = str(len(guessed_states)) + '/50 States Correct' if len(guessed_states) > 0 else "Guess the State"
17 | answer = screen.textinput(title=title, prompt="What's another state name?").title()
18 |
19 | if answer == 'Exit':
20 | missing_states = [state for state in states_list if state not in guessed_states]
21 | missing_states_data = pd.DataFrame(missing_states)
22 | missing_states_data.to_csv("states_to_learn.csv")
23 | break
24 | elif answer in states_list:
25 | guessed_states.append(answer)
26 | t = turtle.Turtle()
27 | t.hideturtle()
28 | t.penup()
29 | state = df[df.state == answer]
30 | t.goto(int(state.x), int(state.y))
31 | t.write(answer)
32 |
--------------------------------------------------------------------------------
/Game - US States/states_to_learn.csv:
--------------------------------------------------------------------------------
1 | ,0
2 | 0,Alabama
3 | 1,Alaska
4 | 2,Arizona
5 | 3,Arkansas
6 | 4,California
7 | 5,Colorado
8 | 6,Connecticut
9 | 7,Delaware
10 | 8,Florida
11 | 9,Georgia
12 | 10,Hawaii
13 | 11,Idaho
14 | 12,Illinois
15 | 13,Indiana
16 | 14,Iowa
17 | 15,Kansas
18 | 16,Kentucky
19 | 17,Louisiana
20 | 18,Maine
21 | 19,Maryland
22 | 20,Massachusetts
23 | 21,Michigan
24 | 22,Minnesota
25 | 23,Mississippi
26 | 24,Missouri
27 | 25,Montana
28 | 26,Nebraska
29 | 27,Nevada
30 | 28,New Hampshire
31 | 29,New Jersey
32 | 30,New Mexico
33 | 31,New York
34 | 32,North Carolina
35 | 33,North Dakota
36 | 34,Ohio
37 | 35,Oklahoma
38 | 36,Oregon
39 | 37,Pennsylvania
40 | 38,Rhode Island
41 | 39,South Carolina
42 | 40,South Dakota
43 | 41,Tennessee
44 | 42,Texas
45 | 43,Utah
46 | 44,Vermont
47 | 45,Virginia
48 | 46,Washington
49 | 47,West Virginia
50 | 48,Wisconsin
51 | 49,Wyoming
52 |
--------------------------------------------------------------------------------
/Hill Cipher/hill_Cipher.py:
--------------------------------------------------------------------------------
1 |
2 | # https://en.wikipedia.org/wiki/Hill_cipher
3 |
4 | def split(a): # splitting the string into its arbitary characters
5 | return [char for char in a]
6 |
7 | def arbitaryNumbers(list): # returning the arbitary value of the alphabets
8 | list_arb=[]
9 | for i in list:
10 | list_arb.append(ord(i)-96)
11 | return list_arb
12 |
13 | def remove(string): # removing all spaces
14 | return string.replace(" ", "")
15 |
16 | def divide_chunks(l, n): # dividing lists into 2 each
17 | # looping till length l
18 | for i in range(0, len(l), n):
19 | yield l[i:i + n]
20 |
21 | def arbChar(list):
22 | chars=[]
23 | for i in list:
24 | chars.append(chr(i))
25 | return chars
26 |
27 | cipherText=input()
28 | cipherText=cipherText.lower()
29 | cipherTextNew=remove(cipherText)
30 |
31 | if len(cipherTextNew)%2!=0: # addition of dummy letter in case it is odd
32 | cipherTextNew+='a'
33 |
34 |
35 | list_aplha=split(cipherTextNew)
36 | arbNum=arbitaryNumbers(list_aplha)
37 |
38 | # [4, 15, 14, 15, 20, 20, 15, 21, 3, 8]
39 |
40 | # matrix=[1,2,0,3]
41 | matrix=[1,24,8,19]
42 | x=list(divide_chunks(arbNum,2))
43 |
44 | cipherNum=[]
45 |
46 | for i in range(len(x)):
47 | sum1=0
48 | sum2=0
49 | sum1=x[i][0]*matrix[0]+x[i][1]*matrix[1]
50 | sum2=x[i][0]*matrix[2]+x[i][1]*matrix[3]
51 | cipherNum.append(sum1)
52 | cipherNum.append(sum2)
53 |
54 | cipherNumArb=[]
55 |
56 | for i in cipherNum:
57 | cipherNumArb.append((i%26)+96)
58 |
59 | hillcipher=arbChar(cipherNumArb)
60 |
61 | finalHillCipher=""
62 |
63 | for i in hillcipher:
64 | finalHillCipher+=i
65 |
66 | finalHillCipher=finalHillCipher.upper()
67 | print(finalHillCipher)
68 |
69 |
--------------------------------------------------------------------------------
/Language-Translate/README.md:
--------------------------------------------------------------------------------
1 | # Language Translate
2 |
3 | A simple script to help translate your text into different languages.
4 |
5 | ## Installation
6 | - Install Python if you already haven't.
7 | - Install all required dependencies by running ``pip install -r requirements.txt``.
8 |
9 | ## Usage
10 | ```bash
11 | python3 language_translate.py
12 | ```
13 |
14 | ```
15 | usage: language_translate.py [-h] [--from_lang FROM_LANG] [--to_lang TO_LANG]
16 |
17 | options:
18 | -h, --help show this help message and exit
19 | --from_lang FROM_LANG
20 | Language to translate from.
21 | --to_lang TO_LANG Language to translate to. (defaults to English)
22 | ```
23 |
--------------------------------------------------------------------------------
/Language-Translate/language_translate.py:
--------------------------------------------------------------------------------
1 | import argparse
2 | from translate import Translator
3 |
4 |
5 | def main():
6 | # Initializing Argument Parser
7 | parser = argparse.ArgumentParser()
8 | parser.add_argument(
9 | "--from_lang", help="Language to translate from.", type=str)
10 | parser.add_argument(
11 | "--to_lang", help="Language to translate to. (defaults to English)",
12 | type=str)
13 | text = input("Enter text to translate: ")
14 | args = parser.parse_args()
15 | # Checking if a from_language is provided. (defaults automatically to English)
16 | # If provided, set from_language in the Translator object.
17 | if args.from_lang:
18 | translator = Translator(
19 | to_lang=args.to_lang if args.to_lang else "English",
20 | from_lang=args.from_lang
21 | )
22 | # Else, do not pass anything for from_language.
23 | else:
24 | translator = Translator(
25 | to_lang=args.to_lang if args.to_lang else "English")
26 | try:
27 | translation = translator.translate(text)
28 | except Exception:
29 | print("Translation Error. Returning...")
30 | return None
31 | print(translation)
32 |
33 |
34 | if __name__ == "__main__":
35 | main()
36 |
--------------------------------------------------------------------------------
/Language-Translate/requirements.txt:
--------------------------------------------------------------------------------
1 | translate
--------------------------------------------------------------------------------
/Mail Merge/Input/Letters/starting_letter.txt:
--------------------------------------------------------------------------------
1 | Dear [name],
2 |
3 | You are invited to my birthday this Saturday.
4 |
5 | Hope you can make it!
6 |
7 | Angela
8 |
--------------------------------------------------------------------------------
/Mail Merge/Input/Names/invited_names.txt:
--------------------------------------------------------------------------------
1 | Aang
2 | Zuko
3 | Appa
4 | Katara
5 | Sokka
6 | Momo
7 | Uncle Iroh
8 | Toph
--------------------------------------------------------------------------------
/Mail Merge/Output/ReadyToSend/letter_for_Aang.txt:
--------------------------------------------------------------------------------
1 | Dear Aang,
2 |
3 | You are invited to my birthday this Saturday.
4 |
5 | Hope you can make it!
6 |
7 | Angela
8 |
--------------------------------------------------------------------------------
/Mail Merge/Output/ReadyToSend/letter_for_Appa.txt:
--------------------------------------------------------------------------------
1 | Dear Appa,
2 |
3 | You are invited to my birthday this Saturday.
4 |
5 | Hope you can make it!
6 |
7 | Angela
8 |
--------------------------------------------------------------------------------
/Mail Merge/Output/ReadyToSend/letter_for_Katara.txt:
--------------------------------------------------------------------------------
1 | Dear Katara,
2 |
3 | You are invited to my birthday this Saturday.
4 |
5 | Hope you can make it!
6 |
7 | Angela
8 |
--------------------------------------------------------------------------------
/Mail Merge/Output/ReadyToSend/letter_for_Momo.txt:
--------------------------------------------------------------------------------
1 | Dear Momo,
2 |
3 | You are invited to my birthday this Saturday.
4 |
5 | Hope you can make it!
6 |
7 | Angela
8 |
--------------------------------------------------------------------------------
/Mail Merge/Output/ReadyToSend/letter_for_Sokka.txt:
--------------------------------------------------------------------------------
1 | Dear Sokka,
2 |
3 | You are invited to my birthday this Saturday.
4 |
5 | Hope you can make it!
6 |
7 | Angela
8 |
--------------------------------------------------------------------------------
/Mail Merge/Output/ReadyToSend/letter_for_Toph.txt:
--------------------------------------------------------------------------------
1 | Dear Toph,
2 |
3 | You are invited to my birthday this Saturday.
4 |
5 | Hope you can make it!
6 |
7 | Angela
8 |
--------------------------------------------------------------------------------
/Mail Merge/Output/ReadyToSend/letter_for_Uncle Iroh.txt:
--------------------------------------------------------------------------------
1 | Dear Uncle Iroh,
2 |
3 | You are invited to my birthday this Saturday.
4 |
5 | Hope you can make it!
6 |
7 | Angela
8 |
--------------------------------------------------------------------------------
/Mail Merge/Output/ReadyToSend/letter_for_Zuko.txt:
--------------------------------------------------------------------------------
1 | Dear Zuko,
2 |
3 | You are invited to my birthday this Saturday.
4 |
5 | Hope you can make it!
6 |
7 | Angela
8 |
--------------------------------------------------------------------------------
/Mail Merge/main.py:
--------------------------------------------------------------------------------
1 | from os import path
2 |
3 |
4 | with open('.\\Input\\Letters\\starting_letter.txt', mode="r") as file:
5 | mail_content = file.read()
6 |
7 | with open('.\\Input\\Names\\invited_names.txt', mode="r") as file:
8 | names = (file.read()).split('\n')
9 |
10 | for name in names:
11 | path = ".\\Output\\ReadyToSend\\letter_for_"+name+".txt"
12 | with open(path, mode="w") as file:
13 | file.write(mail_content.replace("[name]", name))
14 |
--------------------------------------------------------------------------------
/News Reader/main.py:
--------------------------------------------------------------------------------
1 | import requests
2 | import json
3 |
4 |
5 | def read_news(str):
6 | from win32com.client import Dispatch
7 | speak = Dispatch("SAPI.SpVoice")
8 | speak.Speak(str)
9 |
10 |
11 | api_key = '' # your api key
12 |
13 | url = (
14 | f'https://newsapi.org/v2/top-headlines?sources=the-times-of-india&apiKey={api_key}')
15 |
16 | res = requests.get(url).json()
17 | # print(res['articles'][1]['title'])
18 | read_news("Welcome to xyz news...")
19 | for i in range(len(res)):
20 | news = f"News number {i + 1}. Title: {res['articles'][i]['title']}. Description:{res['articles'][i]['description']}"
21 | if i > 0:
22 | read_news("Moving towards the next news")
23 | read_news(news)
24 |
--------------------------------------------------------------------------------
/Password Generator Programs/characters.py:
--------------------------------------------------------------------------------
1 | letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
2 | numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
3 | symbols = ['!', '#', '$', '%', '&', '(', ')', '*', '+']
--------------------------------------------------------------------------------
/Password Generator Programs/password_generator_easy.py:
--------------------------------------------------------------------------------
1 | import random
2 | from characters import letters, numbers, symbols
3 | password=''
4 |
5 | nr_letters= int(input("How many letters would you like in your password?\n"))
6 | nr_symbols = int(input(f"How many symbols would you like?\n"))
7 | nr_numbers = int(input(f"How many numbers would you like?\n"))
8 |
9 | for i in range(1, nr_letters+1):
10 | password += letters[random.randint(0,51)]
11 |
12 | for i in range(1, nr_symbols+1):
13 | password += symbols[random.randint(0,8)]
14 |
15 | for i in range(1, nr_numbers+1):
16 | password += str(numbers[random.randint(0,9)])
17 |
18 | print(f"Password - {password}")
--------------------------------------------------------------------------------
/Password Generator Programs/password_generator_easy_chracters_shuffled.py:
--------------------------------------------------------------------------------
1 | import random
2 | from characters import letters, numbers, symbols
3 | password=[]
4 |
5 | nr_letters= int(input("How many letters would you like in your password?\n"))
6 | nr_symbols = int(input(f"How many symbols would you like?\n"))
7 | nr_numbers = int(input(f"How many numbers would you like?\n"))
8 |
9 | for i in range(1, nr_letters+1):
10 | password.append( letters[random.randint(0,51)])
11 |
12 | for i in range(1, nr_symbols+1):
13 | password.append(symbols[random.randint(0,8)])
14 |
15 | for i in range(1, nr_numbers+1):
16 | password.append(str(numbers[random.randint(0,9)]))
17 |
18 | random.shuffle(password)
19 |
20 | print(f"Password Hard - {''.join(password)}")
--------------------------------------------------------------------------------
/Password Generator Programs/simple_password_generator.py:
--------------------------------------------------------------------------------
1 | import random
2 | from characters import letters, numbers, symbols
3 |
4 | print("Welcome to the Python Password Generator!")
5 | no_of_characters = int(input("How many characters would you like?\n"))
6 |
7 |
8 | ### Taking a random sample from the list of characters, the sample size is same as the number of characters
9 | ### as mentioned in the parameters. Using the join method to make a string out of this list.
10 |
11 | print('Password - ',''.join(random.sample(letters+numbers+symbols, no_of_characters)))
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Python Mini Projects For Beginners
2 |
3 | I created this repository when I began #100DaysOfCode with Python. I've used Python before, but I had switched to JS related web-dev for a few months, so I wanted to start from scratch. So, I decided to create a repository to add a few small projects I'm doing as a part of the course and probably will add some more projects later.
4 |
5 | ## How to use this repository?
6 |
7 | If you're new to Python, you can take a look at some of the mini projects here to take inspiration and get going. This repository will also help you understand what Python is capable of and all that we can potentially achieve with this language.
8 |
9 | ## Contributing
10 |
11 | Please read [Contributing.md](/contributing.md) before making a PR.
12 |
13 | ---
14 | Please star this repository and share with your Python beginner friends :)
15 |
--------------------------------------------------------------------------------
/Script - Convert to Gray Image/grayImg.py:
--------------------------------------------------------------------------------
1 | import cv2
2 | import os
3 | import tkinter as tk
4 | from tkinter import filedialog
5 |
6 | root = tk.Tk()
7 | root.withdraw()
8 | file_path = filedialog.askopenfilename(title = "Select image to start with") # Choose image
9 |
10 | file = file_path.split("/")[-1]
11 | print(file)
12 | img = cv2.imread(file_path) # reads image
13 | grayImg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # recoloring image to gray
14 |
15 | folder_selected = filedialog.askdirectory(title = "Select directory to save image") # Select directory to store gray image
16 |
17 | image_name = os.path.join(folder_selected, f"gray-{file}")
18 | print(f"Saving image at {folder_selected} as gray-{file}")
19 |
20 | cv2.imwrite(image_name, grayImg) # saving gray image
--------------------------------------------------------------------------------
/Script - Convert to Gray Image/requirements.txt:
--------------------------------------------------------------------------------
1 | opencv-python
2 | tkinter
3 |
--------------------------------------------------------------------------------
/Script - Convert to Gray Image/test.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sreekeshiyer/python-beginner-mini-projects/7566bc4ea14d566034ed76fa16318494d6c6ec13/Script - Convert to Gray Image/test.jpg
--------------------------------------------------------------------------------
/Script - Random Song Player/randomSongPlayer.py:
--------------------------------------------------------------------------------
1 | import random, os
2 | from tkinter import filedialog
3 |
4 | music_dir = filedialog.askdirectory(title = "Select directory to play song from") # Select directory to play song from
5 | songs = os.listdir(music_dir) # Make a list of all available files in selected directory
6 | song = random.randint(0,len(songs)) # Generate a random index to play random song
7 | print(f"Now playing {songs[song]}...") # Prints The Song Name
8 | os.startfile(os.path.join(music_dir, songs[song])) # Play song
--------------------------------------------------------------------------------
/Script - Random Song Player/requirements.txt:
--------------------------------------------------------------------------------
1 | tkinter
--------------------------------------------------------------------------------
/Temp_Conv/readme.md:
--------------------------------------------------------------------------------
1 | # This is a program to convert celsius to farenheit using a graphical user interface
2 |
3 | 
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Temp_Conv/temperature.py:
--------------------------------------------------------------------------------
1 | from tkinter import *
2 |
3 | root=Tk()
4 | root.title("CELSIUS--->FARENHEIT")
5 |
6 | e1=Entry(root,width=30,borderwidth=5)
7 | e1.grid(row=3,column=2)
8 | e2=Entry(root,width=35,borderwidth=5)
9 | e2.grid(row=3,column=3)
10 |
11 |
12 | #Button onClicks
13 |
14 | def click(number):
15 | current=e1.get()
16 | e1.delete(0,END)
17 | e1.insert(0,str(current)+str(number))
18 |
19 |
20 | def clear():
21 | e1.delete(0,END)
22 |
23 |
24 | def convert():
25 | num = e1.get()
26 | num1 = int(num)
27 | e2.insert(0,(num1*1.8)+32)
28 |
29 |
30 | #Buttons
31 | Button_1=Button(root,text="1",padx=20,pady=20,command=lambda:click(1)).grid(row=4,column=0)
32 | Button_2=Button(root,text="2",padx=20,pady=20,command=lambda:click(2)).grid(row=4,column=1)
33 | Button_3=Button(root,text="3",padx=20,pady=20,command=lambda:click(3)).grid(row=5,column=0)
34 | Button_4=Button(root,text="4",padx=20,pady=20,command=lambda:click(4)).grid(row=5,column=1)
35 | Button_5=Button(root,text="5",padx=20,pady=20,command=lambda:click(5)).grid(row=6,column=0)
36 | Button_6=Button(root,text="6",padx=20,pady=20,command=lambda:click(6)).grid(row=6,column=1)
37 | Button_7=Button(root,text="7",padx=20,pady=20,command=lambda:click(7)).grid(row=7,column=0)
38 | Button_8=Button(root,text="8",padx=20,pady=20,command=lambda:click(8)).grid(row=7,column=1)
39 | Button_9=Button(root,text="9",padx=20,pady=20,command=lambda:click(9)).grid(row=8,column=0)
40 | Button_0=Button(root,text="0",padx=20,pady=20,command=lambda:click(0)).grid(row=8,column=1)
41 | Button_convert=Button(root,text="--->°F",padx=30,pady=30,command=convert).grid(row=4,column=2)
42 | Button_clear=Button(root,text="CLEAR",padx=30,pady=30,command=clear).grid(row=5,column=2)
43 |
44 | root.mainloop()
--------------------------------------------------------------------------------
/Tip Calculator/tip_calculator.py:
--------------------------------------------------------------------------------
1 | #Calculating the tip
2 | #Using basic arithmetic operators
3 |
4 | print('Welcome to the tip calculator')
5 | bill = float(input('What was the total bill? $'))
6 | tip = int(input('What percentage tip would you like to give? 10, 12 or 15? '))
7 | no_of_people = int(input('How many people to split the bill? '))
8 |
9 |
10 | #Result = (Bill + tip%*bill) / Number of people
11 |
12 | result = (bill + (0.01*tip*bill)) / no_of_people
13 | print("Each person should pay: ${:.2f}".format(result))
--------------------------------------------------------------------------------
/Turtle Drawing/drawing_a_spirograph.py:
--------------------------------------------------------------------------------
1 | from turtle import Turtle, Screen
2 | import random
3 |
4 | tt = Turtle()
5 | screen = Screen()
6 | screen.colormode(255)
7 | tt.speed("fastest")
8 |
9 |
10 | def random_color():
11 | return (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
12 |
13 |
14 | i = 5
15 | tt.setheading(10)
16 | while tt.heading() != 0.0:
17 | tt.color(random_color())
18 | tt.circle(100)
19 | tt.setheading(i)
20 | i += 5
21 |
22 | screen.exitonclick()
23 |
--------------------------------------------------------------------------------
/Turtle Drawing/drawing_a_square.py:
--------------------------------------------------------------------------------
1 | from turtle import Turtle, Screen
2 | from turtle import Turtle, Screen
3 | tt = Turtle()
4 | tt.shape('turtle')
5 | tt.color('blue')
6 |
7 | for i in range(0, 4):
8 | tt.forward(100)
9 | tt.right(90)
10 |
11 |
12 | screen = Screen()
13 | screen.exitonclick()
14 |
--------------------------------------------------------------------------------
/Turtle Drawing/drawing_different_shapes.py:
--------------------------------------------------------------------------------
1 | from turtle import Turtle, Screen
2 | import random
3 | tt = Turtle()
4 | tt.shape('turtle')
5 |
6 | for i in range(3, 11):
7 | tt.color('#'+str(random.randint(100000, 999999)))
8 | for s in range(0, i):
9 | tt.forward(100)
10 | tt.right(360/i)
11 |
12 |
13 | screen = Screen()
14 | screen.exitonclick()
15 |
--------------------------------------------------------------------------------
/Turtle Drawing/hirst_painting.py:
--------------------------------------------------------------------------------
1 | from turtle import Turtle, Screen, numinput
2 | import random
3 |
4 | rgb_colors = [(245, 243, 238), (246, 242, 244), (202, 164, 110), (240, 245, 241), (236, 239, 243), (149, 75, 50), (222, 201, 136), (53, 93, 123), (170, 154, 41), (138, 31, 20), (134, 163, 184), (197,
5 | 92, 73), (47, 121, 86), (73, 43, 35), (145, 178, 149), (14, 98, 70), (232, 176, 165), (160, 142, 158), (54, 45, 50), (101, 75, 77), (183, 205, 171), (36, 60, 74), (19, 86, 89), (82, 148,
6 | 129), (147, 17, 19), (27, 68, 102), (12, 70, 64), (107, 127, 153), (176, 192, 208), (168, 99, 102), (66, 64, 60), (219, 178, 183), (178, 198, 202), (112, 139, 141), (254, 194, 0)]
7 |
8 |
9 | tt = Turtle()
10 | screen = Screen()
11 | screen.colormode(255)
12 | tt.speed("fastest")
13 | tt.penup()
14 | tt.hideturtle()
15 | tt.setheading(135)
16 | tt.forward(300)
17 | tt.setheading(0)
18 |
19 | tt.dot(20, random.choice(rgb_colors))
20 |
21 | num_of_dots = 100
22 |
23 | for count in range(1, num_of_dots+1):
24 | tt.dot(20, random.choice(rgb_colors))
25 | tt.forward(50)
26 |
27 | if count % 10 == 0 and count != 100:
28 | tt.setheading(270)
29 | tt.forward(50)
30 | tt.setheading(180)
31 | tt.forward(500)
32 | tt.setheading(0)
33 |
34 | screen.exitonclick()
35 |
--------------------------------------------------------------------------------
/Turtle Drawing/image.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sreekeshiyer/python-beginner-mini-projects/7566bc4ea14d566034ed76fa16318494d6c6ec13/Turtle Drawing/image.jpg
--------------------------------------------------------------------------------
/Turtle Drawing/random_walk.py:
--------------------------------------------------------------------------------
1 | from turtle import Turtle, Screen
2 | import random
3 | tt = Turtle()
4 | tt.shape('turtle')
5 | screen = Screen()
6 | screen.colormode(255)
7 |
8 | tt.pensize(15)
9 | tt.speed("fastest")
10 |
11 |
12 | def random_color():
13 |
14 | return (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
15 |
16 |
17 | directions = [0, 90, 270]
18 |
19 | for _ in range(300):
20 | tt.color(random_color())
21 | tt.forward(30)
22 | tt.setheading(random.choice(directions))
23 |
24 |
25 | screen.exitonclick()
26 |
--------------------------------------------------------------------------------
/Weather app/main.py:
--------------------------------------------------------------------------------
1 | import requests
2 |
3 |
4 | """
5 | Register yourself in https://openweathermap.org/ and create an account then go to this page: https://home.openweathermap.org/api_keys. Then generate a key
6 | """
7 | # paste your api key here
8 | api_key = "YOUR_API_KEY_HERE"
9 |
10 | # getting city name from user
11 | city = input("Enter city name: ")
12 |
13 | data = requests.get(
14 | f"https://api.openweathermap.org/data/2.5/weather?q={city}&units=metric&APPID={api_key}"
15 | )
16 |
17 | # getting the data
18 | print(f"Location: {data.json().get('name')}, {data.json().get('sys').get('country')}")
19 | print(f"Temperature: {data.json().get('main')['temp']}°C")
20 | print(f"Weather: {data.json().get('weather')[0].get('main')}")
21 | print(f"Min/Max Temperature: {data.json().get('main')['temp_min']}°C/{data.json().get('main')['temp_max']}°C")
22 | print(f"Humidity: {data.json().get('main')['humidity']}%")
23 | print(f"Wind: {data.json().get('wind')['speed']} km/h")
--------------------------------------------------------------------------------
/Weather app/requirements.txt:
--------------------------------------------------------------------------------
1 | requests
--------------------------------------------------------------------------------
/contributing.MD:
--------------------------------------------------------------------------------
1 | # Contributing to this Repository
2 |
3 | - While making a contribution, please ensure that you clearly specify the changes you're making to this repository. Please do not modify or delete the existing projects.
4 | - Feel free to make your own new projects and adding them here.
5 |
6 | ## Why this repository?
7 |
8 | The idea is simple, it is to have people who are very new to Python get a good idea of what the language is capable of, try and explore its different aspects and enjoy the process of project-based learning with Python.
9 |
10 | ## How to Contribute?
11 |
12 | 1. Create a new folder with the title of your project.
13 | 2. Add your Python code in that folder (single or multiple files).
14 | 3. Make a pull request.
15 |
16 | ## Please take note
17 |
18 | - The project has to be simple, I'm not expecting a script that'll break the NASA data centers.
19 | - Try to use simple language, I know *Python enthusiasts* (myself included) fancy their opportunities to get everything done in one line, but this repository is meant to be beginner friendly.
20 | - If you're making use of third-party modules (very likely), please maintain a `requirements.txt` file.
21 | - Please use comments wherever possible. If you think even a small bit of code requires explanation, please add comments. Think like you're just starting out with Python and have absolutely no idea how things work.
22 | - Please refrain from dropping your credentials and API keys. Make use of `config` files, specify with comments that one would require an API key or a Secret key from a certain service.
23 |
24 | Happy contributing!
25 |
--------------------------------------------------------------------------------
/french-flash-cards/data/french_words.csv:
--------------------------------------------------------------------------------
1 | French,English
2 | partie,part
3 | histoire,history
4 | chercher,search
5 | seulement,only
6 | police,police
7 | pensais,thought
8 | aide,help
9 | demande,request
10 | genre,kind
11 | mois,month
12 | frère,brother
13 | laisser,let
14 | car,because
15 | mettre,to put
16 | aucun,no
17 | laisse,leash
18 | eux,them
19 | ville,city
20 | chaque,each
21 | parlé,speak
22 | arrivé,come
23 | devrait,should
24 | bébé,baby
25 | longtemps,long time
26 | heures,hours
27 | vont,will
28 | pendant,while
29 | revoir,meet again
30 | aucune,any
31 | place,square
32 | parle,speak
33 | compris,understood
34 | savais,knew
35 | étaient,were
36 | attention,Warning
37 | voici,here is
38 | pourrais,could
39 | affaire,case
40 | donner,give
41 | type,type
42 | leurs,their
43 | donné,given
44 | train,train
45 | corps,body
46 | endroit,place
47 | yeux,eyes
48 | façon,way
49 | écoute,listen
50 | dont,whose
51 | trouve,find
52 | premier,first
53 | perdu,lost
54 | main,hand
55 | première,first
56 | côté,side
57 | pouvoir,power
58 | vieux,old
59 | sois,be
60 | tiens,here
61 | matin,morning
62 | tellement,so much
63 | enfant,child
64 | point,point
65 | venu,came
66 | suite,after
67 | pardon,sorry
68 | venez,come
69 | devant,in front of
70 | vers,towards
71 | minutes,minutes
72 | demandé,request
73 | chambre,bedroom
74 | mis,placed
75 | belle,beautiful
76 | droit,law
77 | aimerais,would like to
78 | aujourd'hui,today
79 | mari,husband
80 | cause,cause
81 | enfin,finally
82 | espère,hope
83 | eau,water
84 | attendez,Wait
85 | parti,left
86 | nouvelle,new
87 | boulot,job
88 | arrêter,Stop
89 | dirait,would say
90 | terre,Earth
91 | compte,account
92 | donne,given
93 | loin,far
94 | fin,end
95 | croire,believe
96 | chérie,sweetheart
97 | gros,large
98 | plutôt,rather
99 | aura,will have
100 | filles,girls
101 | jouer,to play
102 | bureau,office
--------------------------------------------------------------------------------
/french-flash-cards/images/card_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sreekeshiyer/python-beginner-mini-projects/7566bc4ea14d566034ed76fa16318494d6c6ec13/french-flash-cards/images/card_back.png
--------------------------------------------------------------------------------
/french-flash-cards/images/card_front.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sreekeshiyer/python-beginner-mini-projects/7566bc4ea14d566034ed76fa16318494d6c6ec13/french-flash-cards/images/card_front.png
--------------------------------------------------------------------------------
/french-flash-cards/images/right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sreekeshiyer/python-beginner-mini-projects/7566bc4ea14d566034ed76fa16318494d6c6ec13/french-flash-cards/images/right.png
--------------------------------------------------------------------------------
/french-flash-cards/images/wrong.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sreekeshiyer/python-beginner-mini-projects/7566bc4ea14d566034ed76fa16318494d6c6ec13/french-flash-cards/images/wrong.png
--------------------------------------------------------------------------------
/french-flash-cards/main.py:
--------------------------------------------------------------------------------
1 | import pandas
2 | from tkinter import *
3 | import random
4 |
5 | try:
6 | df = pandas.read_csv("data/words_to_learn.csv")
7 | except FileNotFoundError:
8 | original_data = pandas.read_csv("data/french_words.csv")
9 | to_learn = original_data.to_dict(orient="records")
10 | else:
11 | to_learn = df.to_dict(orient="records")
12 |
13 | current_card = {}
14 |
15 |
16 | def flip_card():
17 | canvas.itemconfig(card_image, image=card_back_img)
18 | canvas.itemconfig(card_title, text="English", fill="white")
19 | canvas.itemconfig(card_word, text=current_card["English"], fill="white")
20 |
21 |
22 | def next_card():
23 | global current_card, flip_timer
24 | window.after_cancel(flip_timer)
25 | canvas.itemconfig(card_image, image=card_front_img)
26 | current_card = random.choice(to_learn)
27 | canvas.itemconfig(card_title, text="French", fill="black")
28 | canvas.itemconfig(card_word, text=current_card["French"], fill="black")
29 | flip_timer = window.after(3000, func=flip_card)
30 |
31 |
32 | def is_known():
33 | to_learn.remove(current_card)
34 | data = pandas.DataFrame(to_learn)
35 | data.to_csv("data/words_to_learn.csv", index=False)
36 | next_card()
37 |
38 |
39 | BACKGROUND_COLOR = "#B1DDC6"
40 |
41 | window = Tk()
42 | window.title("French Flash Cards")
43 | window.config(padx=50, pady=50, bg=BACKGROUND_COLOR)
44 | flip_timer = window.after(3000, func=flip_card)
45 |
46 | canvas = Canvas(width=800, height=526)
47 | card_front_img = PhotoImage(file="images/card_front.png")
48 | card_back_img = PhotoImage(file="images/card_back.png")
49 | card_image = canvas.create_image(400, 263, image=card_front_img)
50 | card_title = canvas.create_text(400, 150, text="Title", font=("Arial", 40, "italic"))
51 | card_word = canvas.create_text(400, 263, text="word", font=("Arial", 60, "bold"))
52 |
53 | canvas.config(bg=BACKGROUND_COLOR, highlightthickness=0)
54 | canvas.grid(row=0, column=0, columnspan=2)
55 |
56 | cross_image = PhotoImage(file="images/wrong.png")
57 | unknown_button = Button(image=cross_image, borderwidth=0, highlightthickness=0, bd=0, command=next_card)
58 | unknown_button.grid(row=1, column=0)
59 |
60 | check_image = PhotoImage(file="images/right.png")
61 | known_button = Button(image=check_image, borderwidth=0, highlightthickness=0, bd=0, command=is_known)
62 | known_button.grid(row=1, column=1)
63 |
64 | next_card()
65 | window.mainloop()
66 |
--------------------------------------------------------------------------------
/nato-alphabet/main.py:
--------------------------------------------------------------------------------
1 | import pandas
2 |
3 | df = pandas.read_csv('nato_phonetic_alphabet.csv')
4 |
5 | phonetic_words_dict = {row.letter: row.code for (index, row) in df.iterrows()}
6 |
7 | word = input("Enter a word: ").upper()
8 |
9 | final_list = [phonetic_words_dict[letter] for letter in word]
10 |
11 | print(final_list)
12 |
--------------------------------------------------------------------------------
/nato-alphabet/nato_phonetic_alphabet.csv:
--------------------------------------------------------------------------------
1 | letter,code
2 | A,Alfa
3 | B,Bravo
4 | C,Charlie
5 | D,Delta
6 | E,Echo
7 | F,Foxtrot
8 | G,Golf
9 | H,Hotel
10 | I,India
11 | J,Juliet
12 | K,Kilo
13 | L,Lima
14 | M,Mike
15 | N,November
16 | O,Oscar
17 | P,Papa
18 | Q,Quebec
19 | R,Romeo
20 | S,Sierra
21 | T,Tango
22 | U,Uniform
23 | V,Victor
24 | W,Whiskey
25 | X,X-ray
26 | Y,Yankee
27 | Z,Zulu
--------------------------------------------------------------------------------
/pdf to text/example.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sreekeshiyer/python-beginner-mini-projects/7566bc4ea14d566034ed76fa16318494d6c6ec13/pdf to text/example.pdf
--------------------------------------------------------------------------------
/pdf to text/new.txt:
--------------------------------------------------------------------------------
1 | Page 1:
2 |
3 | A Simple PDF File
4 | This is a small demonstration .pdf file -
5 | just for use in the Virtual Mechanics tutorials. More text. And more
6 | text. And more text. And more text. And more text.
7 | And more text. And more text. And more text. And more text. And more
8 | text. And more text. Boring, zzzzz. And more text. And more text. And
9 | more text. And more text. And more text. And more text. And more text.
10 | And more text. And more text.
11 | And more text. And more text. And more text. And more text. And more
12 | text. And more text. And more text. Even more. Continued on page 2 ...
13 |
14 |
15 | Page 2:
16 |
17 | Simple PDF File 2
18 | ...continued from page 1. Yet more text. And more text. And more text.
19 | And more text. And more text. And more text. And more text. And more
20 | text. Oh, how boring typing this stuff. But not as boring as watching
21 | paint dry. And more text. And more text. And more text. And more text.
22 | Boring. More, a little more text. The end, and just as well.
23 |
24 |
25 |
--------------------------------------------------------------------------------
/pdf to text/pdfToText.py:
--------------------------------------------------------------------------------
1 | import PyPDF2
2 | import os
3 | import tkinter as tk
4 | from tkinter import filedialog
5 |
6 | root = tk.Tk()
7 | root.withdraw()
8 | file = filedialog.askopenfilename(title = "Select PDF") # Choose PDF to work on
9 | file_name = file.split("/")[-1]
10 | file_name = file_name.split(".")[0]
11 |
12 | pdf = open(file, 'rb')
13 | pdfReader = PyPDF2.PdfFileReader(pdf)
14 |
15 | pages = pdfReader.numPages
16 | s=""
17 | numbering = input("Print page numbers? (Y/n) ").lower()
18 | for pg in range(pages):
19 | if numbering=="y":
20 | s += "Page " + str(pg+1) + ":\n\n"
21 | pageObj = pdfReader.getPage(pg)
22 | texts = pageObj.extractText()
23 | s += texts + "\n\n\n"
24 |
25 | folder_selected = filedialog.askdirectory(title = "Select directory to save converted text file") # Select directory to store the newly created text file
26 | with open(os.path.join(folder_selected, f"{file_name}.txt"), "w") as file_obj:
27 | file_obj.write(s)
28 | print("PDF converted succesfully and stored at", folder_selected)
29 |
--------------------------------------------------------------------------------
/pdf to text/requirements.txt:
--------------------------------------------------------------------------------
1 | PyPDF2
--------------------------------------------------------------------------------