diff --git a/.gitignore b/.gitignore index e43b0f98..b70950ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,15 @@ .DS_Store +.git + +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +.cache +.replit +.config +replit.nix \ No newline at end of file diff --git a/best_practices.md b/best_practices.md index f529dc4d..ca841342 100644 --- a/best_practices.md +++ b/best_practices.md @@ -13,8 +13,6 @@ - UP/DOWN Arrows - Scroll backward and forwards through previous commands you’ve typed in the current session. ​ -- F3 - Repeat the previous command​. - - CTRL + C - Abort the current line you’re typing or a command that is currently executing​. @@ -45,7 +43,7 @@ cd .. # Gets out of the directory you are in ## How do you run a python file? 1. Make sure that you are using the Shell 🐚. 1. Verify that you are in the folder containing the file you want to run. You can use `pwd` to check the current folder and `ls` to see the files in the current folder. -2. Run `python ` (ex: `python session_1.py`). +2. Run `python ` (ex: `python exercises_1.py`). --- diff --git a/session_00/slides_0.md b/session_00/slides_0.md index 7a4e31c1..432977ca 100644 --- a/session_00/slides_0.md +++ b/session_00/slides_0.md @@ -164,8 +164,6 @@ clear # Clears the terminal screen - UP / DOWN Arrows - Scroll backward and forwards through previous commands you’ve typed in the current session. ​ -- F3 - Repeat the previous command​. - - CTRL + C - Abort the current line you’re typing or a command that is currently executing​. @@ -181,18 +179,28 @@ clear # Clears the terminal screen # Steps -### On Github +### I. On [Github](https://github.com/) + +1. Fork the intro-to-python repo → https://github.com/sergiuHudrea/intro-to-python. + - The "Fork" icon will be situated in the top right hand corner. + - When creating the new fork, select your account as the "Owner". +2. Copy the link of your newly forked repository. + - The link should have this format: https://github.com/YOUR_GITHUB_USERNAME/intro-to-python + + +--- -1. Fork the intro-to-python repo → https://github.com/sergiuHudrea/intro-to-python -### On Replit +### II. On [Replit](https://replit.com/) -1. Click on "Create Repl". +1. Click on "Create Repl" in the top right hand corner. 2. Select "Import from GitHub" 3. Paste link of your newly forked repo into the "GitHub URL" section. 4. Click on "Import from GitHub". -4. Check that you have access to the Shell. -5. Start Section A from exercises_0.md. Make sure you click on "Open preview", so you can see nicely formatted. +5. When loaded, click on the "Git" icon from the "Tools" section, situated in the bottom left side. +6. In the newly opened Git window, click on "Connect to GitHub" and follow the steps. Click on "Only selected repositories", select your forked repository, and then click on "Install and Authorize". +7. Open a Shell window and a second window for displaying the contents of the exercises_0.md file. +8. Start Section A from exercises_0.md. Make sure you click on "Open preview", so you can see the content nicely formatted. --- diff --git a/session_01/exercises_1.py b/session_01/exercises_1.py index 6dde3a14..a92d3b62 100644 --- a/session_01/exercises_1.py +++ b/session_01/exercises_1.py @@ -5,8 +5,8 @@ # Commenting out shortcut: # Select the lines you want to comment and press: -# - Windows: ```Ctrl + / ``` -# - Mac: ```Command + /``` +# - Windows: Ctrl + / +# - Mac: Command + / ## Section A diff --git a/session_01/slides_1.md b/session_01/slides_1.md index ae6b7391..01f696d6 100644 --- a/session_01/slides_1.md +++ b/session_01/slides_1.md @@ -118,8 +118,6 @@ clear # Clears the terminal screen - UP/DOWN Arrows - Scroll backward and forwards through previous commands you’ve typed in the current session. ​ -- F3 - Repeat the previous command​. - - CTRL + C - Abort the current line you’re typing or a command that is currently executing​. diff --git a/session_02/slides_2.md b/session_02/slides_2.md index 594ef056..70c95921 100644 --- a/session_02/slides_2.md +++ b/session_02/slides_2.md @@ -279,6 +279,11 @@ print(name[-1]) # Always the last element --- +# Coding Time +## Section A + +--- + # Input --- diff --git a/session_03/answers/B2.py b/session_03/answers/B2.py index 3f6f8416..cc0a0721 100644 --- a/session_03/answers/B2.py +++ b/session_03/answers/B2.py @@ -7,7 +7,7 @@ age = int(input("How old are you?\n")) -if age == 0: +if age <= 0: print ("You're not born yet!") elif age < 11: print("You're too young to go to this school") @@ -15,5 +15,3 @@ print ("You can can come to this school") elif age > 16: print ("You're too old for school") -else: - print("You have not entered your age...") diff --git a/session_03/answers/B8.py b/session_03/answers/B8.py index 722c42ac..422a9440 100644 --- a/session_03/answers/B8.py +++ b/session_03/answers/B8.py @@ -27,7 +27,7 @@ print(lesson1 + " - D grade") elif mark1 <= 45 and mark1 > 25: print(lesson1 + " - E grade") -elif mark1 < 25: +elif mark1 < 25 and mark1 >= 0: print(lesson1 + " - F grade") else: print("Go to see your teacher") @@ -43,7 +43,7 @@ print(lesson2 + " - D grade") elif mark2 <= 45 and mark2 > 25: print(lesson2 + " - E grade") -elif mark2 < 25: +elif mark2 < 25 and mark2 >= 0: print(lesson2 + " - F grade") else: print("Go to see your teacher") @@ -59,7 +59,7 @@ print(lesson3 + " - D grade") elif mark3 <= 45 and mark3 > 25: print(lesson3 + " - E grade") -elif mark3 < 25: +elif mark3 < 25 and mark3 >= 0: print(lesson3 + " - F grade") else: print("Go to see your teacher") \ No newline at end of file diff --git a/session_05/answers/A8.py b/session_05/answers/A8.py index 1c863108..9a807e12 100644 --- a/session_05/answers/A8.py +++ b/session_05/answers/A8.py @@ -1,5 +1,5 @@ # A8 - Rewrite question B2 from Week 4 using a while loop. -i=0 +i = 1 while i < 101: print(i) i += 1 diff --git a/session_05/answers/A9.py b/session_05/answers/A9.py index b0b8f2db..6edf5a09 100644 --- a/session_05/answers/A9.py +++ b/session_05/answers/A9.py @@ -17,7 +17,7 @@ print(lesson + " - D grade") elif mark <= 45 and mark > 25: print(lesson + " - E grade") - elif mark < 25: + elif mark < 25 and mark >= 0: print(lesson + " - F grade") else: print("Go to see your teacher") \ No newline at end of file diff --git a/session_05/slides_5.md b/session_05/slides_5.md index 09fe2b9a..fe65cf4a 100644 --- a/session_05/slides_5.md +++ b/session_05/slides_5.md @@ -318,7 +318,7 @@ while times_in_loop <= 100: x = 1 while x <= 100: print(x) - times_in_loop = times_in_loop + 1 + x = x + 1 for y in range(1, 101): print(y) diff --git a/session_06/answers/B3.py b/session_06/answers/B3.py index a858877d..335b3230 100644 --- a/session_06/answers/B3.py +++ b/session_06/answers/B3.py @@ -35,12 +35,10 @@ print("LETS START!!!!!") winner = None -while not winner: +while winner == None: for current_player in range(players): x = input("Player " + str(current_player) + ": Roll the dice...") - if x == "q": - break dice_roll = str(random.randint(1, 6)) scores[current_player] += 1 print("You rolled a: " + dice_roll) @@ -64,6 +62,6 @@ if sum(beetles[current_player].values()) == 0: winner = current_player -print("The winner is: " + str(winner)) +print("The winner is player: " + str(winner)) print(scores) diff --git a/session_08/exercises_8.py b/session_08/exercises_8.py index 78c59d3a..fcf051c0 100644 --- a/session_08/exercises_8.py +++ b/session_08/exercises_8.py @@ -38,5 +38,5 @@ # 4. Benford’s law states that the leading digits in a collection of data are probably going to be small. # For example, most numbers in a set (about 30%) will have a leading digit of 1, when the expected probability is 11.1% (i.e. one out of nine digits). -# Fake data is usually evenly distributed, where as real data The files 'accounts_1.txt', 'accounts_2.txt' and 'accounts_3.txt' contain financial transaction data. +# Fake data is usually evenly distributed, where as real data isn't. The files 'accounts_1.txt', 'accounts_2.txt' and 'accounts_3.txt' contain financial transaction data. # Work out which of the files contains fake data. diff --git a/session_09/project_info.md b/session_09/project_info.md index a7a1799a..650051c2 100644 --- a/session_09/project_info.md +++ b/session_09/project_info.md @@ -9,7 +9,7 @@ Once done, send your project (the GitHub link of your repo) to UK-DLKPMGPYTHONLE ## Project requirements The project should: -1. Be hosted on [GitHub](https://github.com/). +1. Be hosted on [GitHub](https://github.com/) (all your work must be pushed to GitHub). 2. Contain at least one variable. 3. Contain at least one conditional (`if/else`) statement. 4. Contain at least a function (`my_cool_func()`).