Friday 12 April 2024

How to cycle a fish tank right way

 Here is the fishless cycle. You are adding WAY too much ammonia, and stopping (or greatly slowing) the growth of the very bacteria you want.


I agree: 100% water change, refill (don't forget the dechlor) then allow it to run for 24-48 hours, and check the ammonia. You might find a trace from whatever water lingered after your water change, but it should not keep on rising. If it does, this suggests there is a lot of organic matter, perhaps animal manure, stuck in the pores of the lava rock.

Tuesday 9 April 2024

How to Convert Your International Driving Licence In Australia

If you’ve recently moved to Australia, you might be wondering whether or not your international licence is valid.

In most states, you can drive with an international licence, but only for a short period of time — usually around 3 months. After this period, you will need to transfer your international licence into an Australian state licence, depending on where you’re located. 

The process of transferring an international driver's licence to an Australian driver's licence varies from state to state. 

We explain how to convert your international driving licence in Australia in this state-by-state guide.

Friday 2 February 2024

Dictionary

To add a key-value pair to a blank dictionary
# Create a blank dictionary my_dict = {} # Add a key-value pair my_dict["key"] = "value" # Now my_dict contains {"key": "value"}

We have a dictionary as below

student_scores = {
"Harry": 81,
"Ron": 78,
"Hermione": 99,
"Draco": 74,
"Neville": 62,
}
If we use
for student in student_scores:
score = student_scores[student]
print(score)
The result would be:
81
78
99
74
62
if we use:
for student in student_scores:
score = student_scores[student]
print(student)
The result would be:
Harry
Ron
Hermione
Draco
Neville
if we use:
print(student_scores)
The result would be:
{'Harry': 81, 'Ron': 78, 'Hermione': 99, 'Draco': 74, 'Neville': 62}


How to add dictionary to a list
# Create a list
my_list = []

# Create a dictionary
my_dict = {"key": "value"}

# Add the dictionary to the list
my_list.append(my_dict)

# Now my_list contains the dictionary
How to get the max value in a dictionary
max_value = max(dictionary.value())


Tuesday 30 January 2024

Function

 def greet_with(name, location):

    print(f"hello {name}")
print(f"How is the weather in {location}")
greet_with("Harry", "Inala")

Wednesday 24 January 2024

Convert String to List and List to String

Convert String to List

 my_string = "hello world"


method_1 = list(my_string)
method_2 = my_string.split()
print(method_1)
print(method_2)

The result will be:
['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']
['hello', 'world']

Convert List to String
my_list = ['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']
string_from_list = "".join(my_list)

If your list contains elements other than strings (e.g., numbers), you need to convert them to strings first using the map() function or a list comprehension.

string_from_numbers = ''.join(map(str, my_list_of_numbers))


Monday 22 January 2024

Range

 In Python, range is a built-in function that is used to generate a sequence of numbers. It is commonly used in for loops to iterate a specific number of times or to create sequences of numbers. The basic syntax of the range function is as follows:

range(stop) range(start, stop) range(start, stop, step)
  • start (optional): The starting value of the sequence. If not specified, it defaults to 0.
  • stop: The exclusive upper limit of the sequence. The sequence will stop before reaching this value.
  • step (optional): The step or the difference between each number in the sequence. If not specified, it defaults to 1.

Here are a few examples to illustrate the usage of the range function:

  1. Using range with a Stop Value:

    for i in range(5): print(i)

    Output:

    In this example, range(5) generates a sequence of numbers from 0 to 4.

  2. Using range with Start and Stop Values:

    for i in range(2, 8): print(i)

    Output:

    2 3 4 5 6 7

    Here, range(2, 8) generates a sequence from 2 to 7.

  3. Using range with Start, Stop, and Step Values:

    for i in range(1, 10, 2): print(i)

    Output:

    In this case, range(1, 10, 2) generates a sequence with a step of 2 between numbers.

  4. Creating a List with range:

    numbers = list(range(3, 15, 3)) print(numbers)

    Output:

    [3, 6, 9, 12]

    Here, range(3, 15, 3) is used to create a list of numbers with a step of 3.

The range function is useful when you need to iterate over a sequence of numbers or when you want to create a list of numbers with a specific pattern. Keep in mind that the range function does not create a list directly; it produces a range object. If you need a list, you can convert it using the list() constructor, as shown in the last example.

How to cycle a fish tank right way

  Here is the fishless cycle. You are adding WAY too much ammonia, and stopping (or greatly slowing) the growth of the very bacteria you wan...