-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kristian Rother
committed
Jan 3, 2024
1 parent
ce91f2d
commit 94ba658
Showing
35 changed files
with
465 additions
and
556 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Anagrams | ||
======== | ||
|
||
**🎯 Generate all anagrams of a word with 3-6 letters.** | ||
|
||
For example, the string: | ||
|
||
:: | ||
|
||
ROT | ||
|
||
has the anagrams (permutations of characters): | ||
|
||
:: | ||
|
||
TOR | ||
ORT | ||
TRO | ||
RTO | ||
OTR | ||
|
||
Hints | ||
----- | ||
|
||
- Look up the function ``itertools.permutations()``. | ||
- You may need an expression like ``''.join(["T", "O", "R"])`` | ||
|
||
Extra challenges | ||
---------------- | ||
|
||
- Get yourself a word list. Find anagrams that are real words. | ||
- Implement the algorithm to generate the anagrams yourself. Get | ||
informed about **dynamic programming**. | ||
|
||
*Translated with* `www.DeepL.com <https://www.DeepL.com/Translator>`__ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Baby Name Generator | ||
=================== | ||
|
||
**🎯 Write a baby name generator for undecided parents.** | ||
|
||
Use the function ``random.choice()`` from the `random | ||
module <https://docs.python.org/3/library/random.html#module-random>`__. | ||
|
||
Extra Challenges: | ||
----------------- | ||
|
||
- The program randomly outputs a name from a predefined list. | ||
- The program randomly outputs a name from the `US civil | ||
register <http://www.ssa.gov/oact/babynames/limits.html>`__ | ||
- The user can select either a boy’s or girl’s name | ||
- The programme makes 10 proposals | ||
|
||
*Translated with* `www.DeepL.com <https://www.DeepL.com/Translator>`__ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Birthday Problem | ||
================ | ||
|
||
**🎯 Calculate probabilities** | ||
|
||
You’re attending a party with N guests. | ||
Calculate how likely it is that at least two of them will have a birthday on the same day. | ||
|
||
Hints | ||
----- | ||
|
||
- there are at least two people at the party | ||
- assume that birthdays occur on all days of the year with the same probability. | ||
- ignore leap years | ||
|
||
Questions | ||
--------- | ||
|
||
- How many people have to be there for a >50% or >90% chance? | ||
- What is the probability that there are two or more pairs? | ||
- consider when the assumption that all days have the same probability | ||
makes sense | ||
|
||
*Translated with* `www.DeepL.com <https://www.DeepL.com/Translator>`__ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Checkerboard | ||
============ | ||
|
||
**🎯 Write a program that outputs a chess board with 8 \* 8 squares:** | ||
|
||
:: | ||
|
||
#_#_#_#_ | ||
_#_#_#_# | ||
#_#_#_#_ | ||
_#_#_#_# | ||
#_#_#_#_ | ||
_#_#_#_# | ||
#_#_#_#_ | ||
|
||
Extra Challenges | ||
---------------- | ||
|
||
- use a single ``print()`` statement | ||
- the characters ``#`` and ``_`` occur only once in the program | ||
- do not use the assignment operator ``=`` | ||
|
||
*Translated with* `www.DeepL.com <https://www.DeepL.com/Translator>`__ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Christmas Tree | ||
============== | ||
|
||
**🎯 Write a program that outputs the following image:** | ||
|
||
:: | ||
|
||
* | ||
*** | ||
***** | ||
******* | ||
********* | ||
*********** |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.