1596785930
Pacman frogs are named after the famous Pacman game. The frogs have a figure like the Pacman monster. They are round, bright-colored, and have a wider mouth.
If you love frogs and toads and frogs, you can think of having a Pacman frog as your pet. They are quite entertaining to watch. In this article, you can get a comprehensive guide about how to give proper Pacman frog care.
Male Pacman frogs are smaller than females. They are a maximum of 4 inches in diameter. On the other hand, a female Pacman frog can reach up to 7inche in length and width. Additionally, they are long-living amphibians and can comfortably live for 15 years.
Pacman frogs are quite predatorial by nature. They can even attack and consume another Pacman frog or even a mate. So, it is better to keep them alone. But you can also keep a male and a female frog together.
** Their habitat**
Pacman frogs are initially from the dense and lush rainforest areas in Africa. So, they live in a humid and moist environment. A ten or a twenty-gallon aquarium is enough to keep a Pacman frog. You need to use a secure lid over the aquarium to prevent the frog from escaping.
They need a proper habitat. Otherwise, they may not live long and die even in a few months. You need to fill the base of the aquarium with a deep layer of the substrate. A moist substrate made with peat moss, coir, sphagnum moss, etc. is the best because it can retain moisture. You need to make it deep enough so that your pet frog can burrow inside it and rest there. So, for male frogs, 5 to six inches deep substrate is enough. For the female frogs, you need to use eight to ten inches substrate.
In addition to that, you need to recreate the atmosphere of the rainforest inside the aquarium. For those, you need to arrange the live plants densely. It will also provide your frog with a hiding place. Additionally, the live plants also help in retaining the moisture. The Pacman frogs absorb water through their skin. So, if the habitat is not humid enough, they might get dehydrated.
It is better to keep the terrarium away from direct sunlight. It can decrease the moisture level and will cause dehydration. So, keep the tank in a cool place away from direct sunlight.
You need to maintain the hygiene of their habitat. Or, tour frog might develop some illness. Make sure to clean the aquarium per week. If you are handling your pet, make sure to wash your hands and wear a glove. Oils of human skin are harmful to Pacman frogs. It also increases the risk of salmonella poisoning.
** Temperature and light**
Pacman frogs are ectotherms. That means they need an external source of heat to maintain their body temperature. In general, this species is comfortable in the ambient temperature ranging from 65 to 85 degrees F. You can use a broad-spectrum light bulb above the tank. It is excellent for APcman and other frogs. You need to provide 12 hours of light and dark per day so that your pet gets to maintain its biological clock.
**Food **
Pacman frogs are gluttons. They will eat anytime. But, you need to prevent overfeeding. Because Pacman frogs tend to overeat and will become obese. Pacman frogs eat insects, small mammals, snakes, reptiles, etc. You need to provide them with a variety of insects and other types of foods routinely. It will ensure your pet gets nutrition, protein, and vitamins in the proper dose,
You can provide small Pacman frogs crickets, mealworms, wax worms, small dubia roaches, etc. Adults and medium frogs eat pinkie mice, full-sized dubia roaches, etc. If you have an adult Pacman frog, provide them with small pice or pinkie rats. You need to deliver your frog’s food every day. Larger animals like pinkie mice, little mice, pinkie rats, etc. are excellent for once or twice per week.
Here is the essential guide for those who aim to have a Pacman frog as their pet. If you need more guidance, you can always visit a pet store or handler to get more information.
#pacman frog care
1672928580
Bash has no built-in function to take the user’s input from the terminal. The read command of Bash is used to take the user’s input from the terminal. This command has different options to take an input from the user in different ways. Multiple inputs can be taken using the single read command. Different ways of using this command in the Bash script are described in this tutorial.
read [options] [var1, var2, var3…]
The read command can be used without any argument or option. Many types of options can be used with this command to take the input of the particular data type. It can take more input from the user by defining the multiple variables with this command.
Some options of the read command require an additional parameter to use. The most commonly used options of the read command are mentioned in the following:
Option | Purpose |
---|---|
-d <delimiter> | It is used to take the input until the delimiter value is provided. |
-n <number> | It is used to take the input of a particular number of characters from the terminal and stop taking the input earlier based on the delimiter. |
-N <number> | It is used to take the input of the particular number of characters from the terminal, ignoring the delimiter. |
-p <prompt> | It is used to print the output of the prompt message before taking the input. |
-s | It is used to take the input without an echo. This option is mainly used to take the input for the password input. |
-a | It is used to take the input for the indexed array. |
-t <time> | It is used to set a time limit for taking the input. |
-u <file descriptor> | It is used to take the input from the file. |
-r | It is used to disable the backslashes. |
The uses of read command with different options are shown in this part of this tutorial.
Example 1: Using Read Command without Any Option and variable
Create a Bash file with the following script that takes the input from the terminal using the read command without any option and variable. If no variable is used with the read command, the input value is stored in the $REPLY variable. The value of this variable is printed later after taking the input.
#!/bin/bash
#Print the prompt message
echo "Enter your favorite color: "
#Take the input
read
#Print the input value
echo "Your favorite color is $REPLY"
Output:
The following output appears if the “Blue” value is taken as an input:
Example 2: Using Read Command with a Variable
Create a Bash file with the following script that takes the input from the terminal using the read command with a variable. The method of taking the single or multiple variables using a read command is shown in this example. The values of all variables are printed later.
#!/bin/bash
#Print the prompt message
echo "Enter the product name: "
#Take the input with a single variable
read item
#Print the prompt message
echo "Enter the color variations of the product: "
#Take three input values in three variables
read color1 color2 color3
#Print the input value
echo "The product name is $item."
#Print the input values
echo "Available colors are $color1, $color2, and $color3."
Output:
The following output appears after taking a single input first and three inputs later:
Example 3: Using Read Command with -p Option
Create a Bash file with the following script that takes the input from the terminal using the read command with a variable and the -p option. The input value is printed later.
#!/bin/bash
#Take the input with the prompt message
read -p "Enter the book name: " book
#Print the input value
echo "Book name: $book"
Output:
The following output appears after taking the input:
Example 4: Using Read Command with -s Option
Create a Bash file with the following script that takes the input from the terminal using the read command with a variable and the -s option. The input value of the password will not be displayed for the -s option. The input values are checked later for authentication. A success or failure message is also printed.
#!/bin/bash
#Take the input with the prompt message
read -p "Enter your email: " email
#Take the secret input with the prompt message
read -sp "Enter your password: " password
#Add newline
echo ""
#Check the email and password for authentication
if [[ $email == "admin@example.com" && $password == "secret" ]]
then
#Print the success message
echo "Authenticated."
else
#Print the failure message
echo "Not authenticated."
fi
Output:
The following output appears after taking the valid and invalid input values:
Example 5: Using Read Command with -a Option
Create a Bash file with the following script that takes the input from the terminal using the read command with a variable and the -a option. The array values are printed later after taking the input values from the terminal.
#!/bin/bash
echo "Enter the country names: "
#Take multiple inputs using an array
read -a countries
echo "Country names are:"
#Read the array values
for country in ${countries[@]}
do
echo $country
done
Output:
The following output appears after taking the array values:
Example 6: Using Read Command with -n Option
Create a Bash file with the following script that takes the input from the terminal using the read command with a variable and the -n option.
#!/bin/bash
#Print the prompt message
echo "Enter the product code: "
#Take the input of five characters
read -n 5 code
#Add newline
echo ""
#Print the input value
echo "The product code is $code"
Output:
The following output appears if the “78342” value is taken as input:
Example 7: Using Read Command with -t Option
Create a Bash file with the following script that takes the input from the terminal using the read command with a variable and the -t option.
#!/bin/bash
#Print the prompt message
echo -n "Write the result of 10-6: "
#Take the input of five characters
read -t 3 answer
#Check the input value
if [[ $answer == "4" ]]
then
echo "Correct answer."
else
echo "Incorrect answer."
fi
Output:
The following output appears after taking the correct and incorrect input values:
The uses of some useful options of the read command are explained in this tutorial using multiple examples to know the basic uses of the read command.
Original article source at: https://linuxhint.com/
1637595900
Em primeiro lugar, uma pesquisa linear, também conhecida como pesquisa sequencial, este método é usado para localizar um elemento dentro de uma lista ou array. Ele verifica cada elemento da lista um por um / sequencialmente até que uma correspondência seja encontrada ou toda a lista tenha sido pesquisada.
Implemente a pesquisa linear seguindo as etapas abaixo:
target
valor ao valor fornecido da lista / matriz.-1
.# python program for linear search using while loop
#define list
lst = []
#take input list size
num = int(input("Enter size of list :- "))
for n in range(num):
#append element in list/array
numbers = int(input("Enter the array of %d element :- " %n))
lst.append(numbers)
#take input number to be find in list
x = int(input("Enter number to search in list :- "))
i = 0
flag = False
while i < len(lst):
if lst[i] == x:
flag = True
break
i = i + 1
if flag == 1:
print('{} was found at index {}.'.format(x, i))
else:
print('{} was not found.'.format(x))
Depois de executar o programa, a saída será:
Enter size of list :- 5
Enter the array of 0 element :- 10
Enter the array of 1 element :- 23
Enter the array of 2 element :- 56
Enter the array of 3 element :- 89
Enter the array of 4 element :- 200
Enter number to search in list :- 89
89 was found at index 3.
# python program for linear search using for loop
#define list
lst = []
#take input list size
num = int(input("Enter size of list :- "))
for n in range(num):
#append element in list/array
numbers = int(input("Enter the array of %d element :- " %n))
lst.append(numbers)
#take input number to be find in list
x = int(input("Enter number to search in list :- "))
i = 0
flag = False
for i in range(len(lst)):
if lst[i] == x:
flag = True
break
if flag == 1:
print('{} was found at index {}.'.format(x, i))
else:
print('{} was not found.'.format(x))
Depois de executar o programa, a saída será:
Enter size of list :- 6
Enter the array of 0 element :- 25
Enter the array of 1 element :- 50
Enter the array of 2 element :- 100
Enter the array of 3 element :- 200
Enter the array of 4 element :- 250
Enter the array of 5 element :- 650
Enter number to search in list :- 200
200 was found at index 3.
# python program for linear search using for loop
#define list
lst = []
#take input list size
num = int(input("Enter size of list :- "))
for n in range(num):
#append element in list/array
numbers = int(input("Enter the array of %d element :- " %n))
lst.append(numbers)
#take input number to be find in list
x = int(input("Enter number to search in list :- "))
# Recursive function to linear search x in arr[l..r]
def recLinearSearch( arr, l, r, x):
if r < l:
return -1
if arr[l] == x:
return l
if arr[r] == x:
return r
return recLinearSearch(arr, l+1, r-1, x)
res = recLinearSearch(lst, 0, len(lst)-1, x)
if res != -1:
print('{} was found at index {}.'.format(x, res))
else:
print('{} was not found.'.format(x))
Depois de executar o programa, a saída será:
Enter size of list :- 5
Enter the array of 0 element :- 14
Enter the array of 1 element :- 25
Enter the array of 2 element :- 63
Enter the array of 3 element :- 42
Enter the array of 4 element :- 78
Enter number to search in list :- 78
78 was found at index 4.
1637563159
Trước hết, Tìm kiếm tuyến tính, còn được gọi là tìm kiếm tuần tự, phương pháp này được sử dụng để tìm một phần tử trong danh sách hoặc mảng. Nó kiểm tra từng phần tử của danh sách một / tuần tự cho đến khi tìm thấy một kết quả phù hợp hoặc toàn bộ danh sách đã được tìm kiếm.
Triển khai tìm kiếm tuyến tính theo các bước sau:
target
giá trị với giá trị đã cho của danh sách / mảng.-1
.# python program for linear search using while loop
#define list
lst = []
#take input list size
num = int(input("Enter size of list :- "))
for n in range(num):
#append element in list/array
numbers = int(input("Enter the array of %d element :- " %n))
lst.append(numbers)
#take input number to be find in list
x = int(input("Enter number to search in list :- "))
i = 0
flag = False
while i < len(lst):
if lst[i] == x:
flag = True
break
i = i + 1
if flag == 1:
print('{} was found at index {}.'.format(x, i))
else:
print('{} was not found.'.format(x))
Sau khi thực hiện chương trình, kết quả đầu ra sẽ là:
Enter size of list :- 5
Enter the array of 0 element :- 10
Enter the array of 1 element :- 23
Enter the array of 2 element :- 56
Enter the array of 3 element :- 89
Enter the array of 4 element :- 200
Enter number to search in list :- 89
89 was found at index 3.
# python program for linear search using for loop
#define list
lst = []
#take input list size
num = int(input("Enter size of list :- "))
for n in range(num):
#append element in list/array
numbers = int(input("Enter the array of %d element :- " %n))
lst.append(numbers)
#take input number to be find in list
x = int(input("Enter number to search in list :- "))
i = 0
flag = False
for i in range(len(lst)):
if lst[i] == x:
flag = True
break
if flag == 1:
print('{} was found at index {}.'.format(x, i))
else:
print('{} was not found.'.format(x))
Sau khi thực hiện chương trình, kết quả đầu ra sẽ là:
Enter size of list :- 6
Enter the array of 0 element :- 25
Enter the array of 1 element :- 50
Enter the array of 2 element :- 100
Enter the array of 3 element :- 200
Enter the array of 4 element :- 250
Enter the array of 5 element :- 650
Enter number to search in list :- 200
200 was found at index 3.
# python program for linear search using for loop
#define list
lst = []
#take input list size
num = int(input("Enter size of list :- "))
for n in range(num):
#append element in list/array
numbers = int(input("Enter the array of %d element :- " %n))
lst.append(numbers)
#take input number to be find in list
x = int(input("Enter number to search in list :- "))
# Recursive function to linear search x in arr[l..r]
def recLinearSearch( arr, l, r, x):
if r < l:
return -1
if arr[l] == x:
return l
if arr[r] == x:
return r
return recLinearSearch(arr, l+1, r-1, x)
res = recLinearSearch(lst, 0, len(lst)-1, x)
if res != -1:
print('{} was found at index {}.'.format(x, res))
else:
print('{} was not found.'.format(x))
Sau khi thực hiện chương trình, kết quả đầu ra sẽ là:
Enter size of list :- 5
Enter the array of 0 element :- 14
Enter the array of 1 element :- 25
Enter the array of 2 element :- 63
Enter the array of 3 element :- 42
Enter the array of 4 element :- 78
Enter number to search in list :- 78
78 was found at index 4.
1637592240
Eine lineare Suche, auch bekannt als sequentielle Suche, diese Methode wird verwendet, um ein Element innerhalb einer Liste oder eines Arrays zu finden. Es überprüft jedes Element der Liste nacheinander / sequentiell, bis eine Übereinstimmung gefunden wird oder die gesamte Liste durchsucht wurde.
Implementieren Sie die lineare Suche mit den folgenden Schritten:
target
Wert mit dem angegebenen Wert der Liste/des Arrays.-1
.# python program for linear search using while loop
#define list
lst = []
#take input list size
num = int(input("Enter size of list :- "))
for n in range(num):
#append element in list/array
numbers = int(input("Enter the array of %d element :- " %n))
lst.append(numbers)
#take input number to be find in list
x = int(input("Enter number to search in list :- "))
i = 0
flag = False
while i < len(lst):
if lst[i] == x:
flag = True
break
i = i + 1
if flag == 1:
print('{} was found at index {}.'.format(x, i))
else:
print('{} was not found.'.format(x))
Nach der Ausführung des Programms lautet die Ausgabe:
Enter size of list :- 5
Enter the array of 0 element :- 10
Enter the array of 1 element :- 23
Enter the array of 2 element :- 56
Enter the array of 3 element :- 89
Enter the array of 4 element :- 200
Enter number to search in list :- 89
89 was found at index 3.
# python program for linear search using for loop
#define list
lst = []
#take input list size
num = int(input("Enter size of list :- "))
for n in range(num):
#append element in list/array
numbers = int(input("Enter the array of %d element :- " %n))
lst.append(numbers)
#take input number to be find in list
x = int(input("Enter number to search in list :- "))
i = 0
flag = False
for i in range(len(lst)):
if lst[i] == x:
flag = True
break
if flag == 1:
print('{} was found at index {}.'.format(x, i))
else:
print('{} was not found.'.format(x))
Nach der Ausführung des Programms lautet die Ausgabe:
Enter size of list :- 6
Enter the array of 0 element :- 25
Enter the array of 1 element :- 50
Enter the array of 2 element :- 100
Enter the array of 3 element :- 200
Enter the array of 4 element :- 250
Enter the array of 5 element :- 650
Enter number to search in list :- 200
200 was found at index 3.
# python program for linear search using for loop
#define list
lst = []
#take input list size
num = int(input("Enter size of list :- "))
for n in range(num):
#append element in list/array
numbers = int(input("Enter the array of %d element :- " %n))
lst.append(numbers)
#take input number to be find in list
x = int(input("Enter number to search in list :- "))
# Recursive function to linear search x in arr[l..r]
def recLinearSearch( arr, l, r, x):
if r < l:
return -1
if arr[l] == x:
return l
if arr[r] == x:
return r
return recLinearSearch(arr, l+1, r-1, x)
res = recLinearSearch(lst, 0, len(lst)-1, x)
if res != -1:
print('{} was found at index {}.'.format(x, res))
else:
print('{} was not found.'.format(x))
Nach der Ausführung des Programms lautet die Ausgabe:
Enter size of list :- 5
Enter the array of 0 element :- 14
Enter the array of 1 element :- 25
Enter the array of 2 element :- 63
Enter the array of 3 element :- 42
Enter the array of 4 element :- 78
Enter number to search in list :- 78
78 was found at index 4.
1636296420
このチュートリアルでは、Pythonで線形検索プログラムを作成する方法を学習します。
まず、線形検索(シーケンシャル検索とも呼ばれます)は、リストまたは配列内の要素を見つけるために使用されます。一致するものが見つかるか、リスト全体が検索されるまで、リストの各要素を1つずつ/順番にチェックします。
以下の手順に従って線形検索を実装します。
target
値をリスト/配列の指定された値に関連付け ます。-1
ます。# python program for linear search using while loop
#define list
lst = []
#take input list size
num = int(input("Enter size of list :- "))
for n in range(num):
#append element in list/array
numbers = int(input("Enter the array of %d element :- " %n))
lst.append(numbers)
#take input number to be find in list
x = int(input("Enter number to search in list :- "))
i = 0
flag = False
while i < len(lst):
if lst[i] == x:
flag = True
break
i = i + 1
if flag == 1:
print('{} was found at index {}.'.format(x, i))
else:
print('{} was not found.'.format(x))
プログラムの実行後、出力は次のようになります。
Enter size of list :- 5
Enter the array of 0 element :- 10
Enter the array of 1 element :- 23
Enter the array of 2 element :- 56
Enter the array of 3 element :- 89
Enter the array of 4 element :- 200
Enter number to search in list :- 89
89 was found at index 3.
# python program for linear search using for loop
#define list
lst = []
#take input list size
num = int(input("Enter size of list :- "))
for n in range(num):
#append element in list/array
numbers = int(input("Enter the array of %d element :- " %n))
lst.append(numbers)
#take input number to be find in list
x = int(input("Enter number to search in list :- "))
i = 0
flag = False
for i in range(len(lst)):
if lst[i] == x:
flag = True
break
if flag == 1:
print('{} was found at index {}.'.format(x, i))
else:
print('{} was not found.'.format(x))
プログラムの実行後、出力は次のようになります。
Enter size of list :- 6
Enter the array of 0 element :- 25
Enter the array of 1 element :- 50
Enter the array of 2 element :- 100
Enter the array of 3 element :- 200
Enter the array of 4 element :- 250
Enter the array of 5 element :- 650
Enter number to search in list :- 200
200 was found at index 3.
# python program for linear search using for loop
#define list
lst = []
#take input list size
num = int(input("Enter size of list :- "))
for n in range(num):
#append element in list/array
numbers = int(input("Enter the array of %d element :- " %n))
lst.append(numbers)
#take input number to be find in list
x = int(input("Enter number to search in list :- "))
# Recursive function to linear search x in arr[l..r]
def recLinearSearch( arr, l, r, x):
if r < l:
return -1
if arr[l] == x:
return l
if arr[r] == x:
return r
return recLinearSearch(arr, l+1, r-1, x)
res = recLinearSearch(lst, 0, len(lst)-1, x)
if res != -1:
print('{} was found at index {}.'.format(x, res))
else:
print('{} was not found.'.format(x))
プログラムの実行後、出力は次のようになります。
Enter size of list :- 5
Enter the array of 0 element :- 14
Enter the array of 1 element :- 25
Enter the array of 2 element :- 63
Enter the array of 3 element :- 42
Enter the array of 4 element :- 78
Enter number to search in list :- 78
78 was found at index 4.