mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-09-02 22:02:39 +02:00
feat: use black
compliant formatting (#8393)
This commit is contained in:
@@ -198,6 +198,7 @@ def divide(a, b):
|
|||||||
finally:
|
finally:
|
||||||
print("Execution completed.")
|
print("Execution completed.")
|
||||||
|
|
||||||
|
|
||||||
print(divide(10, 2)) # Result: 5.0
|
print(divide(10, 2)) # Result: 5.0
|
||||||
print(divide(10, 0)) # Error: Division by zero is not allowed.
|
print(divide(10, 0)) # Error: Division by zero is not allowed.
|
||||||
```
|
```
|
||||||
|
@@ -45,6 +45,7 @@ Here's an example:
|
|||||||
```python
|
```python
|
||||||
from conans import ConanFile, CMake
|
from conans import ConanFile, CMake
|
||||||
|
|
||||||
|
|
||||||
class MyLibraryConan(ConanFile):
|
class MyLibraryConan(ConanFile):
|
||||||
name = "MyLibrary"
|
name = "MyLibrary"
|
||||||
version = "0.1"
|
version = "0.1"
|
||||||
|
@@ -15,9 +15,9 @@ The output will be something like:
|
|||||||
```python
|
```python
|
||||||
import random
|
import random
|
||||||
|
|
||||||
prepositions = ['at', 'in', 'on', 'with', 'under', 'over']
|
prepositions = ["at", "in", "on", "with", "under", "over"]
|
||||||
verbs = ['run', 'jump', 'dance', 'sing', 'laugh', 'cry']
|
verbs = ["run", "jump", "dance", "sing", "laugh", "cry"]
|
||||||
nouns = ['cat', 'dog', 'tree', 'flower', 'book', 'computer']
|
nouns = ["cat", "dog", "tree", "flower", "book", "computer"]
|
||||||
|
|
||||||
preposition = random.choice(prepositions)
|
preposition = random.choice(prepositions)
|
||||||
verb = random.choice(verbs)
|
verb = random.choice(verbs)
|
||||||
@@ -26,7 +26,6 @@ noun = random.choice(nouns)
|
|||||||
madlib = f"I {verb} {preposition} the {noun}."
|
madlib = f"I {verb} {preposition} the {noun}."
|
||||||
|
|
||||||
print(madlib)
|
print(madlib)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Commenting and Reformatting Code
|
## Commenting and Reformatting Code
|
||||||
@@ -62,8 +61,7 @@ for i in range(num_points):
|
|||||||
y = int(round(amplitude * math.sin(2 * math.pi * frequency * i / num_points)))
|
y = int(round(amplitude * math.sin(2 * math.pi * frequency * i / num_points)))
|
||||||
|
|
||||||
# Print a space for padding, followed by an asterisk at the appropriate position on the wave
|
# Print a space for padding, followed by an asterisk at the appropriate position on the wave
|
||||||
print(' ' * (amplitude + y) + '*')
|
print(" " * (amplitude + y) + "*")
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Debugging
|
## Debugging
|
||||||
@@ -113,7 +111,6 @@ for i in numbers:
|
|||||||
if j in numbers:
|
if j in numbers:
|
||||||
numbers.remove(j)
|
numbers.remove(j)
|
||||||
print(numbers)
|
print(numbers)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that we asked the bot to "act like a senior developer" to optimize the script. You can also dictate that it have a certain area of expertise (e.g., sorting algorithms) or number of years of experience. Alternatively, if you have a script that seems overly complicated, you can ask ChatGPT to write that script "as a very junior developer."
|
Note that we asked the bot to "act like a senior developer" to optimize the script. You can also dictate that it have a certain area of expertise (e.g., sorting algorithms) or number of years of experience. Alternatively, if you have a script that seems overly complicated, you can ask ChatGPT to write that script "as a very junior developer."
|
||||||
@@ -151,7 +148,6 @@ salary = float(input("Enter employee's salary: "))
|
|||||||
ss_tax = salary * 0.062
|
ss_tax = salary * 0.062
|
||||||
|
|
||||||
print("Social Security tax is: $", round(ss_tax, 2))
|
print("Social Security tax is: $", round(ss_tax, 2))
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Learn more from the following resources:
|
Learn more from the following resources:
|
||||||
|
@@ -8,6 +8,7 @@ In programming, a function is a reusable block of code that executes a certain f
|
|||||||
def greet(name):
|
def greet(name):
|
||||||
print(f"Hello, {name}!")
|
print(f"Hello, {name}!")
|
||||||
|
|
||||||
|
|
||||||
greet("Roadmap.sh")
|
greet("Roadmap.sh")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user