code-rag-bench/online-tutorials huggingface dataset:
Arithmetic Aptitude 6 - GeeksforGeeks

20 Oct, 2015
Let us divide 4000 by 17.

17) 4000 (235
       34
       ....
         60
         51
        .....
           90
           85
          .....
             5

We get 5 as remainder.
Number to be added = 17-5 = 12
Let us divide 5000 by 23.

23) 5000 (217
      46
      ....
        40
        23
        ....
         170
         161
         .....
            9

We get 9 as remainder.

Therefore required number to be subtracted = 9
The required number must be divisible by L.C.M. of 5,6 and 7.
L.C.M. of 5, 6 and 7 = 5 x 6 x 7 = 210

Let us divide 9999 by 210.

210) 9999 (47
      840
     ----
      1599
      1470
      ----
       129

Required number = 9999 – 129 = 9870
Pattern is (22- 1), (32- – 1), (42- – 1), (52- – 1), ....

Next number will be = 72- – 1 = 49 – 1 = 48
 11'th result = sum of 21 results – sum of 20 results
             = 21 x 20 – (24 x 10 + 14 x 10)
             = 420 – (240 + 140)
             = 420- 380 = 40
Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.
Must Do Coding Questions for Product Based Companies
Difference between var, let and const keywords in JavaScript
Array of Objects in C++ with Examples
How to Replace Values in Column Based on Condition in Pandas?
C Program to read contents of Whole File
Hash Functions and list/types of Hash functions
How to Replace Values in a List in Python?
Spring - REST Controller
How to Read Text Files with Pandas?
Python Data Structures and Algorithms
\vDash - Tex Command

\vDash - Used to create vDash symbol.
{ \vDash}
\vDash command draws vDash symbol.

\vDash

⊨



\vDash

⊨


\vDash

    14 Lectures 
     52 mins

 Ashraf Said

    11 Lectures 
     1 hours 

 Ashraf Said

    9 Lectures 
     1 hours 

 Emenwa Global, Ejike IfeanyiChukwu

    29 Lectures 
     2.5 hours 

 Mohammad Nauman

    14 Lectures 
     1 hours 

 Daniel Stern

    15 Lectures 
     47 mins

 Nishant Kumar
 Print
 Add Notes
 Bookmark this page
Bootstrap Horizontal Form

To create a horizontal form in Bootstrap, follow the below steps −
 Add a class of .form-horizontal to the parent <form> element.
 Wrap labels and controls in a <div> with class .form-group.
 Add a class of .control-label to the labels.
You can try to run the following code to create a horizontal form in Bootstrap −
Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <link rel = "stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css">
      <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
      <script src = "https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
   </head>
   <body>
      <form class = "form-horizontal" role = "form">
         <div class = "form-group">
            <label for = "firstname" class = "col-sm-2 control-label">First Name</label>
            <div class = "col-sm-10">
               <input type = "text" class = "form-control" id = "firstname" placeholder = "Enter First Name">
            </div>
         </div>
         <div class = "form-group">
            <label for = "lastname" class = "col-sm-2 control-label">Last Name</label>
            <div class = "col-sm-10">
               <input type = "text" class = "form-control" id = "lastname" placeholder = "Enter Last Name">
            </div>
         </div>
         <div class = "form-group">
            <div class = "col-sm-offset-2 col-sm-10">
               <div class = "checkbox">
                  <label><input type = "checkbox"> Remember me</label>
               </div>
            </div>
         </div>
         <div class = "form-group">
            <div class = "col-sm-offset-2 col-sm-10">
               <button type = "submit" class = "btn btn-default">Sign in</button>
            </div>
         </div>
      </form>
   </body>
</html>
MySQL DROP DATABASE Statement

The DROP DATABASE statement is used to drop an existing SQL database.
Note: Be careful before dropping a database. Deleting 
a database will result in loss of complete information stored in the database!
The following SQL statement drops the existing database "testDB":
Tip: Make sure you have admin privilege before dropping any database. Once a 
database is dropped, you can check it in the list of databases with the 
following SQL command: SHOW DATABASES;
Write the correct SQL statement to delete a database named testDB.
;

Start the Exercise
We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
blank=True - Django Built-in Field Validation - GeeksforGeeks

18 Oct, 2021
Built-in Field Validations in Django models are the default validations that come predefined to all Django fields. Every field comes in with built-in validations from Django validators. One can also add more built-in field validations for applying or removing certain constraints on a particular field. blank=True will make the field accept blank values. It simply means that field can be empty.Syntax 
field_name = models.Field(blank = True)
 
Illustration of null=True using an Example. Consider a project named geeksforgeeks having an app named geeks.  
Refer to the following articles to check how to create a project and an app in Django.  
How to Create a Basic Project using MVT in Django?
How to Create an App in Django ?
Enter the following code into models.py file of geeks app. We will be using CharField for experimenting for all field options.  
Python3
from django.db import modelsfrom django.db.models import Model# Create your models here. class GeeksModel(Model):    geeks_field = models.CharField(max_length = 200, blank = True)
After running makemigrations and migrate on Django and rendering the above model, let us try to create an instance using None from Django shell. To start Django shell, enter the command,  
Python manage.py shell
Now let us try to create instance of GeeksModel using empty string.  
Python3
# importing required modelfrom geeks.models import GeeksModel # creating instance of GeeksModels = GeeksModel.objects.create(geeks_field = "") # saving current model instances.save()
Let us check in admin interface if the instance of model is created.  
Therefore, blank=True modifies the field to accept empty values or in python’s terms “” Values.  
Note that this is different than null. null is purely database-related, whereas blank is validation-related. If a field has blank=True, form validation will allow entry of an empty value. If a field has blank=False, the field will be required. null=True and blank=True are often used simultaneously. The combo of the two is so frequent because typically if you’re going to allow a field to be blank in your form, you’re going to also need your database to allow NULL values for that field. 
 
.math-table { border-collapse: collapse; width: 100%; } .math-table td { border: 1px solid #5fb962; text-align: left !important; padding: 8px; } .math-table th { border: 1px solid #5fb962; padding: 8px; } .math-table tr>th{ background-color: #c6ebd9; vertical-align: middle; } .math-table tr:nth-child(odd) { background-color: #ffffff; } 
 
 
NaveenArora
sagar0719kumar
Django-models
Python Django
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python Dictionary
Read a file line by line in Python
Enumerate() in Python
How to Install PIP on Windows ?
Iterate over a list in Python
Different ways to create Pandas Dataframe
Python String | replace()
Python program to convert a list to string
Reading and Writing to text files in Python
sum() function in Python
How to set dynamic property keys to an object in JavaScript?

Previously it is a two-step process to create a property in an object but the advent of ES6 has made the task very simple. In only one step we can create a property dynamically. Let's discuss it in a nutshell.
In the following example, the property, instead of declaring in the object itself, is declared outside the object, making it a two-step process.
Live Demo
<html>
<body>
<script>
   let person = 'name';
   let student = {               // step-1
      id: 1,
   };
   student[person] = 'nani';    // step-2
   document.write(JSON.stringify(student));
</script>
</body>
</html>
{"id":1,"name":"nani"}
In the following example, the property of the object is declared directly in the object itself rather than declaring it outside the object, making it a 1 step process
Live Demo
<html>
<body>
<script>
   let person = 'name';
   let student = {
      id: 1,
      [person] : "nani"
   };
   document.write(JSON.stringify(student));
</script>
</body>
</html>
{"id":1,"name":"nani"}
Convert Python List to numpy Arrays - GeeksforGeeks

09 Jul, 2021
A list in Python is a linear data structure that can hold heterogeneous elements they do not require to be declared and are flexible to shrink and grow. On the other hand, an array is a data structure which can hold homogeneous elements, arrays are implemented in Python using the NumPy library. Arrays require less memory than list.
The similarity between an array and a list is that the elements of both array and a list can be identified by its index value.In Python lists can be converted to arrays by using two methods from the NumPy library:  
Using numpy.array() 
Python3
# importing libraryimport numpy # initializing listlst = [1, 7, 0, 6, 2, 5, 6] # converting list to arrayarr = numpy.array(lst) # displaying listprint ("List: ", lst) # displaying arrayprint ("Array: ", arr)
Output: 
List:  [1, 7, 0, 6, 2, 5, 6]
Array:  [1 7 0 6 2 5 6]
Using numpy.asarray() 
Python3
# importing libraryimport numpy # initializing listlst = [1, 7, 0, 6, 2, 5, 6] # converting list to arrayarr = numpy.asarray(lst) # displaying listprint ("List:", lst) # displaying arrayprint ("Array: ", arr)
Output: 
List:  [1, 7, 0, 6, 2, 5, 6]
Array:  [1 7 0 6 2 5 6]
The vital difference between the above two methods is that numpy.array() will make a duplicate of the original object and numpy.asarray() would mirror the changes in the original object. i.e :
When a copy of the array is made by using numpy.asarray(), the changes made in one array would be reflected in the other array also but doesn’t show the changes in the list by which if the array is made. However, this doesn’t happen with numpy.array().
Python3
# importing libraryimport numpy # initializing listlst = [1, 7, 0, 6, 2, 5, 6] # converting list to arrayarr = numpy.asarray(lst) # displaying listprint ("List:", lst) # displaying arrayprint ("arr: ", arr) # made another array out of arr using asarray functionarr1 = numpy.asarray(arr) #displaying arr1 before the changes madeprint("arr1: " , arr1) #change made in arr1arr1[3] = 23 #displaying arr1 , arr , list after the change has been madeprint("lst: " , lst)print("arr: " , arr)print("arr1: " , arr1)
Output :
List: [1, 7, 0, 6, 2, 5, 6]
arr:  [1 7 0 6 2 5 6]
arr1:  [1 7 0 6 2 5 6]
lst:  [1, 7, 0, 6, 2, 5, 6]
arr:  [ 1  7  0 23  2  5  6]
arr1:  [ 1  7  0 23  2  5  6]
In “arr” and “arr1” the change is visible at index 3 but not in 1st.
riyaaggarwaldtu
abhishek0719kadiyan
Picked
Pyhton numpy-arrayCreation
python-list
Python
python-list
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Enumerate() in Python
How to Install PIP on Windows ?
Different ways to create Pandas Dataframe
Python String | replace()
sum() function in Python
Create a Pandas DataFrame from Lists
How to drop one or multiple columns in Pandas Dataframe
*args and **kwargs in Python
Graph Plotting in Python | Set 1
How To Convert Python Dictionary To JSON?
Calculate Cumulative Product of a Numeric Object in R Programming – cumprod() Function - GeeksforGeeks

05 Jun, 2020
cumprod() function in R Language is used to calculate the cumulative product of the vector passed as argument.
Syntax: cumprod(x)
Parameters:x: Numeric Object
Example 1:
# R program to illustrate # the use of cumprod() Function  # Calling cumprod() Functioncumprod(1:4)cumprod(-1:-6)
Output:
[1]  1  2  6 24
[1]   -1    2   -6   24 -120  720

Example 2:
# R program to illustrate # the use of cumprod() Function  # Creating Vectorsx1 <- c(2, 4, 5, 7)x2 <- c(2.4, 5.6, 3.4)  # Calling cumprod() Functioncumprod(x1)cumprod(x2)
Output:
[1]   2   8  40 280
[1]  2.400 13.440 45.696

R DataFrame-Function
R Math-Function
R Matrix-Function
R Vector-Function
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Replace specific values in column in R DataFrame ?
How to change Row Names of DataFrame in R ?
Filter data by multiple conditions in R using Dplyr
Change Color of Bars in Barchart using ggplot2 in R
Loops in R (for, while, repeat)
Printing Output of an R Program
How to Change Axis Scales in R Plots?
Group by function in R using Dplyr
How to Split Column Into Multiple Columns in R DataFrame?
K-Means Clustering in R Programming
C Program to find direction of growth of stack - GeeksforGeeks

14 May, 2017
Prerequisite : Memory Layout of C Programs
In a typical process, a stack segment of program contains local variables along with information that is saved each time a function is called. Each time a function is called, the address of where to return to and certain information about the caller’s environment, such as some of the machine registers, are saved on the stack. The newly called function then allocates room on the stack for its automatic and temporary variables.
Stack may grow downward or upward depending on environment for which code is compiled, i.e., depends on compiler. How to know whether stack grows downward or upward?
The idea is to do following :1) Make a local variable in main.2) Write another function fun() with its own local variable.3) Make a call to fun() from main. Compare addresses of two local variable. If address of fun()’s local variable is more than main’s local variable, then stack grows upward (i.e., addresses increase)
// C program to check whether stack grows// downward or upward.#include<stdio.h>  void fun(int *main_local_addr){    int fun_local;    if (main_local_addr < &fun_local)        printf("Stack grows upward\n");    else        printf("Stack grows downward\n");}  int main(){    // fun's local variable    int main_local;      fun(&main_local);    return 0;}
This article is contributed by Akash Sharan. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
c-puzzle
system-programming
C Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
TCP Server-Client implementation in C
Multithreading in C
Exception Handling in C++
'this' pointer in C++
UDP Server-Client implementation in C
Arrow operator -> in C/C++ with Examples
Understanding "extern" keyword in C
Smart Pointers in C++ and How to Use Them
Storage Classes in C
Ways to copy a vector in C++
C++ Vector Library - operator== Function

The C++ function std::vector::operator== tests whether two vectors are equal or not.
Operator == first checks the size of both container, if sizes are same then it compares elements sequentially and comparison stops at first mismatch.
Following is the declaration for std::vector::operator== function form std::vector header.
template <class T, class Alloc>
bool operator== (const vector<T,Alloc>& v1, const vector<T,Alloc>& v2);

v1 − First vector.
v1 − First vector.
v2 − Second vector.
v2 − Second vector.
Returns true if both vectors are equal otherwise false.
This function never throws exception.
Linear i.e. O(n)
The following example shows the usage of std::vector::operator== function.
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
   vector<int> v1;
   vector<int> v2;

   if (v1 == v2)
      cout << "v1 and v2 are equal" << endl;

   v1.resize(10, 100);

   if (!(v1 == v2))
      cout << "v1 and v2 are not equal" << endl;

   return 0;
}
Let us compile and run the above program, this will produce the following result −
v1 and v2 are equal
v1 and v2 are not equal

 Print
 Add Notes
 Bookmark this page
JasmineJS - Boolean Check

Apart from equality check, Jasmine provides some methods to check Boolean conditions too. Following are the methods that help us check Boolean conditions.
This Boolean matcher is used in Jasmine to check whether the result is equal to true or false.
The following example will help us understand the working principle of the toBeTruthy() function.
describe("Different Methods of Expect Block",function () {
   it("The Example of toBeTruthy() method",function () {   
      expect(expectexam.exampleoftrueFalse(5)).toBeTruthy();    
   });
}); 
window.expectexam = {  
   exampleoftrueFalse: function (num) {  
      if(num < 10)    
         return true;  
      else   
         return false;  
   },  
};
As we are passing number 5, which is smaller than 10, this test case will pass and give us the following output.
If we pass a number which is larger than 10, then this green test will change to red. In the second screenshot, you can see that on passing some value which is greater than 10, the expected test case fails and generates red output stating that “Expected false to be truthy”.
toBeFalsy() also works the same way as toBeTruthy() method. It matches the output to be false whereas toBeTruthy matches the output to be true. The following example will help you understand the basic working principles of toBeFalsy().
describe("Different Methods of Expect Block",function() { 
   it("The Example of toBeTruthy() method",function () {
      expect(expectexam.exampleoftrueFalse(15)).toBeFalsy();   
   });
});
window.expectexam = {  
   exampleoftrueFalse: function (num) {  
      if(num < 10)    
         Return true;  
      else   
         return false; 
   },
}; 
The above code will pass the Jasmine test case as we are passing value more than 10 and expected the output to be false. Hence, the browser will show us a green sign which means it has passed.
 Print
 Add Notes
 Bookmark this page
Exceptions Vs Errors in PHP - GeeksforGeeks

30 Oct, 2019
Error: An Error is an unexpected program result, which can not be handled by the program itself. That can be solved by using the issue in the code manually. An Error can be an infinite loop that can not be handled by the program itself so you have to manually repair that issue. There is an easy procedure to handle error i.e. using die() function.Syntax:
die("message")
Program:
<?php  // Open file in read mode$file_var = fopen("myfile.txt", "r");  // Check for file existenceif (!file_exists("myfile.txt")) {    die("Sorry Error!! file does not exists");}else {    fopen("myfile.txt", "r");}  ?>
Output:
Sorry Error!! file does not exists

Exception: An Exception also is an unexpected result of a program but Exception can be handled by the program itself by throwing another exception. Exceptions should only be used with error conditions, where the error is non removal. There is an easy way to overcome the Exception by using try and catch method.
Syntax:
try {

}
catch {

}

Program:
<?php  function valid_division($x, $y) {          if($y != 0) {        return true;    }    else {        throw new Exception("Why should not be equal to 0");    }}  try {    valid_division(2, 0);          // Try block will only run if     // there is no exception    echo "Valid division";}catch(Exception $e) {          // Catch block will run if an    // exception occurs    echo "Error\n";    echo $e->getmessage();}   ?>
Output:
Error
Why should not be equal to 0

Summary of Differences:
Note: PHP is an exception light language by default, but you can change errors into exceptions when working with object-oriented code.
Akanksha_Rai
Picked
PHP Programs
Web Technologies
Web technologies Questions
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Insert Form Data into Database using PHP ?
How to convert array to string in PHP ?
How to check whether an array is empty using PHP?
Comparing two dates in PHP
How to pass JavaScript variables to PHP ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Python | Check if any element in list satisfies a condition - GeeksforGeeks

13 Oct, 2019
Sometimes, while working with Python lists, we can have a problem to filter a list. One of the criteria of performing this filter operation can be checking if any element exists in list that satisfies a condition. Let’s discuss certain ways in which this problem can be solved.
Method #1 : Using list comprehensionThis problem can be easily solved using loops. But this method provides a one liner to solve this problem. List comprehension just checks for any element that satisfies a condition.
# Python3 code to demonstrate working of# Check if any element in list satisfies a condition# Using list comprehension  # initializing listtest_list = [4, 5, 8, 9, 10, 17]  # printing listprint("The original list : " + str(test_list))  # Check if any element in list satisfies a condition# Using list comprehensionres = True in (ele > 10 for ele in test_list)  # Printing resultprint("Does any element satisfy specified condition ? : " + str(res))
 
The original list : [4, 5, 8, 9, 10, 17]
Does any element satisfy specified condition ? : True

 
Method #2 : Using any()This the most generic method to solve this particular problem. In this we just use the inbuilt function extended by Python library to solve this task. It checks for any element satisfying a condition and returns a True in case it finds any one element.
# Python3 code to demonstrate working of# Check if any element in list satisfies a condition# Using any()  # initializing listtest_list = [4, 5, 8, 9, 10, 17]  # printing listprint("The original list : " + str(test_list))  # Check if any element in list satisfies a condition# Using any()res = any(ele > 10 for ele in test_list)  # Printing resultprint("Does any element satisfy specified condition ? : " + str(res))
 
The original list : [4, 5, 8, 9, 10, 17]
Does any element satisfy specified condition ? : True

Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Python program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
JavaScript SyntaxError - Function statement requires a name - GeeksforGeeks

23 Jul, 2020
This JavaScript exception function statement requires a name that occurs if there is any function statement in the script which requires a name.
Message:
Syntax Error: Expected identifier (Edge)
SyntaxError: function statement requires a name [Firefox]
SyntaxError: Unexpected token ( [Chrome]

Error Type:
Syntax Error

Cause of Error: Any function statement in the code that needs a name. Just check how functions are defined and if necessary provide a name for it, or if the function in question requires to be a function expression,
Example 1: In this example, the function name is provided, So the error has not occurred.
HTML
<!DOCTYPE html><html><head>    <title>Syntax Error</title></head><body>    <script>      var GFG = function () {        return 'Hello Geek';      }      document.write(GFG());    </script></body></html>
Output:
Hello Geek

Example 2: In this example, the function name is not provided, So the error occurred.
HTML
<!DOCTYPE html><html><head>   <title>Syntax Error</title></head><body>    <script>      function () {        return 'Hello Geek';      }    </script></body></html>
Output(in console):
SyntaxError: Function statements require a function name

JavaScript-Errors
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
JavaScript | Promises
How to get character array from string in JavaScript?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Difference between var, let and const keywords in JavaScript
PHP | DOMElement getAttribute() Function - GeeksforGeeks

20 Feb, 2020
The DOMElement::getAttribute() function is an inbuilt function in PHP which is used to get the value of the attribute with name for the current node.
Syntax:
string DOMElement::getAttribute( string $name )
Parameters: This function accepts a single parameter $name which holds the name of the attribute.
Return Value: This function returns an string value containing the attribute value.
Below given programs illustrate the DOMElement::getAttribute() function in PHP:
Program 1:
<?php  // Create a new DOMDocument$dom = new DOMDocument();  // Load the XML$dom->loadXML("<?xml version=\"1.0\"?><body>    <strong attr=\"value\"> 22 </strong></body>");  // Get the strong element$element = $dom->getElementsByTagName('strong');  // Get the attribute$value = $element[0]->getAttribute('attr');echo $value;?>
Output:
value
Program 2:
<?php  // Create a new DOMDocument$dom = new DOMDocument();  // Load the XML$dom->loadXML("<?xml version=\"1.0\"?><body>    <div id=\"div1\"> DIV 1 </div>    <div id=\"div2\"> DIV 2 </div>    <div id=\"div3\"> DIV 3 </div></body>");  // Get all the div elements$elements = $dom->getElementsByTagName('div');  // Get the id value of each elementecho "All the id values of divs are: <br>";foreach ($elements as $element) {    echo $element->getAttribute('id') . "<br>";}?>
Output:
All the id values of divs are:
div1
div2
div3
Reference: https://www.php.net/manual/en/domelement.getattribute.php
PHP-DOM
PHP-function
PHP
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Insert Form Data into Database using PHP ?
How to convert array to string in PHP ?
How to Upload Image into Database and Display it using PHP ?
How to check whether an array is empty using PHP?
PHP | Converting string to Date and DateTime
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Python String count() Method - GeeksforGeeks

05 Aug, 2021
Python String count() function is an inbuilt function in python programming language that returns the number of occurrences of a substring in the given string.
Syntax: 
string.count(substring, start=..., end=...)
Parameters: 
The count() function has one compulsory and two optional parameters. Mandatory parameter: substring – string whose count is to be found.Optional Parameters: start (Optional) – starting index within the string where the search starts. end (Optional) – ending index within the string where the search ends.
Mandatory parameter: substring – string whose count is to be found.
substring – string whose count is to be found.
Optional Parameters: start (Optional) – starting index within the string where the search starts. end (Optional) – ending index within the string where the search ends.
start (Optional) – starting index within the string where the search starts. 
end (Optional) – ending index within the string where the search ends.
Return Value:
count() method returns an integer that denotes number of times a substring occurs in a given string. 
Python3
# Python program to demonstrate the use of# count() method without optional parameters   # string in which occurrence will be checkedstring = "geeks for geeks"   # counts the number of times substring occurs in # the given string and returns an integerprint(string.count("geeks"))
Output: 
2
Python3
# Python program to demonstrate the use of# count() method  using optional parameters  # string in which occurrence will be checkedstring = "geeks for geeks"   # counts the number of times substring occurs in # the given string between index 0 and 5 and returns # an integerprint(string.count("geeks", 0, 5))  print(string.count("geeks", 0, 15))
Output: 
1
2
nidhi_biet
shubham_singh
AmiyaRanjanRout
python-string
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Read JSON file using Python
Adding new column to existing DataFrame in Pandas
Python map() function
How to get column names in Pandas dataframe
Python Dictionary
Taking input in Python
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
TypeScript | Array slice() Method - GeeksforGeeks

03 Mar, 2021
The Array.slice() is an inbuilt TypeScript function which is used to extract a section of an array and returns a new array.Syntax:
 array.slice( begin [,end] ); 
Parameter: This method accepts two parameter as mentioned above and described below:
begin : This parameter is the Zero-based index at which to begin extraction.
end : This parameter is the Zero-based index at which to end extraction.
Return Value: This method returns the extracted array . Below example illustrate the  Array slice() method in TypeScriptJS:Example 1: 
TypeScript
// Driver codevar arr = [ 11, 89, 23, 7, 98 ];  // use of slice() method var val = arr.slice(2, 4);      // printingconsole.log( val );
Output: 
[ 23, 7 ]
Example 2: 
TypeScript
// Driver code var arr = ["G", "e", "e", "k", "s", "f", "o", "r",             "g", "e", "e", "k", "s"];  var val;  // use of slice() method  val = arr.slice(2, 6); console.log( val ); val = arr.slice(5, 8); console.log( val );
Output: 
[ 'e', 'k', 's', 'f' ]
[ 'f', 'o', 'r' ]
pratikraut0000
TypeScript
JavaScript
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Remove elements from a JavaScript Array
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
Differences between Functional Components and Class Components in React
How to append HTML code to a div using JavaScript ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
MoviePy – Getting Audio part from the Video File Clip - GeeksforGeeks

18 Aug, 2020
In this article we will see how we can get audio part of the video file clip in MoviePy. MoviePy is a Python module for video editing, which can be used for basic operations on videos and GIF’s. Video is formed by the frames, combination of frames creates a video each frame is an individual image. An audio file format is a file format for storing digital audio data on a computer system. The bit layout of the audio data is called the audio coding format and can be uncompressed, or compressed to reduce the file size, often using lossy compression. We can load the audio file with the help of AudioFileClip method.
In order to do this we will use audio attribute with the video file clip object
Syntax : clip.audio
Argument : It takes no argument
Return : It returns AudioFileClip object
Below is the implementation
# Import everything needed to edit video clipsfrom moviepy.editor import *  # loading video gfgclip = VideoFileClip("geeks.mp4")  # getting only first 3 secondsclip = clip.subclip(0, 3)  # getting audio from the clipaudioclip = clip.audio  # printing audio clipprint(audioclip)
Output :
moviepy.audio.io.AudioFileClip.AudioFileClip object at 0x0000028BA1F6E488

Another example
# Import everything needed to edit video clipsfrom moviepy.editor import *     # loading video dsa gfg intro videoclip = VideoFileClip("dsa_geek.webm")    # getting only first 3 secondsclip = clip.subclip(0, 3)  # getting audio from the clipaudioclip = clip.audio  # printing audio clipprint(audioclip)
Output :
None

Python-MoviePy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace()
*args and **kwargs in Python
Reading and Writing to text files in Python
Create a Pandas DataFrame from Lists
Comma separator for numbers in R - GeeksforGeeks

28 Dec, 2021
In this article, we are going to see the separation of numbers using a comma in R Programming Language. A comma separator in number will give clarity of a number, and we can count easily when a number is separated by a comma.
It can be done with these ways:
Using prettyNum()Using format()
Using prettyNum()
Using format()
Method 1: Using prettyNum()
This function is used to separate the number.
Syntax: prettyNum(input_number, big.mark = “,”, scientific = FALSE)
Parameters:
input_number – input number
big mark- it is an separator such that the number should be separated by the given delimiter.
scientific parameter – It is set to FALSE.
Return: Number separated by comma
Example 1: R program to separate the number with a comma.
R
# input numberx = 70589999999 # number separated with comma with# prettyNumprettyNum(x, big.mark = ",", scientific = FALSE)
Output:
'70,589,999,999'
Example 2: R program to separate the number with a comma with scientific values
R
# input numberx = 45000000000000000000 # number separated with comma with# prettyNum scientific = FALSEprettyNum(x, big.mark = ",", scientific = FALSE) # number separated with comma with# prettyNum with scientific = TRUEprettyNum(x, big.mark = ",", scientific = TRUE)
Output:
'45,000,000,000,000,000,000'
'4.5e+19'
Note: we will not get the comma-separated number when scientific is set to FALSE
Method 2: Using the format()
Used to format the number with a separator
Syntax: format(input_number, big.mark = “,”, scientific = FALSE)
Parameters:
input_number – input number
big mark- it is an separator such that the number should be separated by the given delimiter.
scientific parameter – It is set to FALSE.
Return: Number separated by comma.
Example 1: R program to separate the number with comma
R
# input numberx = 70589999999 # number separated with comma with  formatprettyNum(x, big.mark = ",", scientific = FALSE)
Output:
'70,589,999,999'
Example 2: R program to separate the number with a comma with scientific values
R
# input numberx = 720589999999 # number separated with comma with# format scientific = FALSEformat(x, big.mark = ",", scientific = FALSE) # number separated with comma with# format with scientific = TRUEformat(x, big.mark = ",", scientific = TRUE)
Output:
'720,589,999,999'
'7.2059e+11'
sumitgumber28
Picked
R String-Functions
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Change Color of Bars in Barchart using ggplot2 in R
Group by function in R using Dplyr
How to Change Axis Scales in R Plots?
How to Split Column Into Multiple Columns in R DataFrame?
Replace Specific Characters in String in R
How to filter R DataFrame by values in a column?
R - if statement
How to filter R dataframe by multiple conditions?
Plot mean and standard deviation using ggplot2 in R
How to import an Excel File into R ?
Difference between Bit Rate and Baud Rate - GeeksforGeeks

08 Jun, 2020
Both Bit rate and Baud rate are generally used in data communication,
Bit rate is the transmission of number of bits per second. On the other hand, Baud rate is defined as the number of signal units per second. The formula which relates both bit rate and baud rate is given below:
Bit rate = Baud rate x the number of bit per baud. 
Let’s see the difference between Bit Rate and Baud Rate:
= baud rate x the number of bit per baud 
= bit rate / the number of bit per baud 
ashushrma378
Computer Networks
Difference Between
GATE CS
Computer Networks
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
RSA Algorithm in Cryptography
Differences between TCP and UDP
Data encryption standard (DES) | Set 1
Differences between IPv4 and IPv6
Types of Network Topology
Difference between BFS and DFS
Class method vs Static method in Python
Differences between TCP and UDP
Difference between var, let and const keywords in JavaScript
Differences between IPv4 and IPv6
Python - Combine two dictionaries having key of the first dictionary and value of the second dictionary - GeeksforGeeks

01 Oct, 2020
Given two dictionaries. The task is to merge them in such a way that the resulting dictionary contains the key from the first dictionary and value from the second dictionary.
Examples:
Input : test_dict1 = {“Gfg” : 20, “is” : 36, “best” : 100}, test_dict2 = {“Gfg2” : 26, “is2” : 20, “best2” : 70} Output : {‘Gfg’: 26, ‘is’: 20, ‘best’: 70} Explanation : Similar index keys’ values assigned to dictionary 1.
Input : test_dict1 = {“Gfg” : 20, “best” : 100}, test_dict2 = {“Gfg2” : 26, “best2” : 70} Output : {‘Gfg’: 26, ‘best’: 70} Explanation : Similar index keys’ values assigned to dictionary 1. 
Method #1 : Using loop + keys()
This is one way in which this task can be performed. In this, we extract all the keys using keys() and then assign required values inside loop.
Python3
# Python3 code to demonstrate working of # Assign similar index values in Dictionary# Using loop + keys()  # initializing dictionariestest_dict1 = {"Gfg" : 20, "is" : 36, "best" : 100}test_dict2 = {"Gfg2" : 26, "is2" : 19, "best2" : 70}  # printing original dictionariesprint("The original dictionary 1 is : " + str(test_dict1))print("The original dictionary 2 is : " + str(test_dict2))  # extracting keys and valueskeys1 = list(test_dict1.keys())vals2 = list(test_dict2.values())  # assigning new values res = dict()for idx in range(len(keys1)):    res[keys1[idx]] = vals2[idx]      # printing result print("Mapped dictionary : " + str(res)) 
The original dictionary 1 is : {‘Gfg’: 20, ‘is’: 36, ‘best’: 100}The original dictionary 2 is : {‘Gfg2’: 26, ‘is2’: 19, ‘best2’: 70}Mapped dictionary : {‘Gfg’: 26, ‘is’: 19, ‘best’: 70}
Method #2 : Using zip() + values()
This is yet another way in which this task can be performed. In this, we perform the task of mapping using zip(), extracting values using values().
Python3
# Python3 code to demonstrate working of # Assign similar index values in Dictionary# Using zip() + values()  # initializing dictionariestest_dict1 = {"Gfg" : 20, "is" : 36, "best" : 100}test_dict2 = {"Gfg2" : 26, "is2" : 19, "best2" : 70}  # printing original dictionariesprint("The original dictionary 1 is : " + str(test_dict1))print("The original dictionary 2 is : " + str(test_dict2))  # using zip() to perform required dict. mapping res = dict(zip(test_dict1, test_dict2.values()))      # printing result print("Mapped dictionary : " + str(res)) 
The original dictionary 1 is : {‘Gfg’: 20, ‘is’: 36, ‘best’: 100}The original dictionary 2 is : {‘Gfg2’: 26, ‘is2’: 19, ‘best2’: 70}Mapped dictionary : {‘Gfg’: 26, ‘is’: 19, ‘best’: 70}
Python dictionary-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Python program to convert a list to string
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
How to create a group column in an R data frame?

Suppose we have a data frame called df that contains two columns say X and Y then we can create a group column based on X and Y by converting df into a data.table object and creating list of values in X and Y with list function.
Check out the below Examples to understand how it can be done.
Following snippet creates a sample data frame −
x1<-rpois(20,2)
x2<-rpois(20,2)
df1<-data.frame(x1,x2)
df1
The following dataframe is created
  x1 x2
1  1 5
2  1 1
3  0 1
4  1 1
5  2 1
6  2 3
7  4 2
8  0 4
9  2 1
10 2 2
11 0 1
12 3 1
13 3 3
14 4 3
15 2 0
16 1 3
17 2 1
18 3 1
19 5 1
20 3 2
To load data.table object and create a group column for values in df1 on the above created data frame, add the following code to the above snippet −
x1<-rpois(20,2)
x2<-rpois(20,2)
df1<-data.frame(x1,x2)
library(data.table)
setDT(df1)[,Group:=.GRP,by=list(x1,x2)]
df1
If you execute all the above given snippets as a single program, it generates the following Output −
   x1 x2 Group
1:  1  5 1
2:  1  1 2
3:  0  1 3
4:  1  1 2
5:  2  1 4
6:  2  3 5
7:  4  2 6
8:  0  4 7
9:  2  1 4
10: 2 2  8
11: 0 1  3
12: 3 1  9
13: 3 3 10
14: 4 3 11
15: 2 0 12
16: 1 3 13
17: 2 1  4
18: 3 1  9
19: 5 1 14
20: 3 2 15
Following snippet creates a sample data frame −
y1<-sample(LETTERS[1:4],20,replace=TRUE)
y2<-sample(LETTERS[1:4],20,replace=TRUE)
df2<-data.frame(y1,y2)
df2
The following dataframe is created
  y1 y2
1  B C
2  B D
3  D C
4  D B
5  A B
6  D A
7  A C
8  A C
9  D B
10 C C
11 A A
12 C D
13 B C
14 C C
15 A A
16 D B
17 B A
18 C B
19 C B
20 C B
To create a group column for values in df2 on the above created data frame, add the following code to the above snippet −
y1<-sample(LETTERS[1:4],20,replace=TRUE)
y2<-sample(LETTERS[1:4],20,replace=TRUE)
df2<-data.frame(y1,y2)
setDT(df2)[,Group:=.GRP,by=list(y1,y2)]
df2
If you execute all the above given snippets as a single program, it generates the following Output −
  y1 y2 Group
1:  B C  1
2:  B D  2
3:  D C  3
4:  D B  4
5:  A B  5
6:  D A  6
7:  A C  7
8:  A C  7
9:  D B  4
10: C C  8
11: A A  9
12: C D 10
13: B C  1
14: C C  8
15: A A  9
16: D B  4
17: B A 11
18: C B 12
19: C B 12
20: C B 12
Crystal Reports - If Then Else

The if-then-Else statement is the most basic of all the control flow statements. It tells your program to execute a certain section of code only if a particular condition meets true.
If you see the following If-Then-Else statement with Boolean operators, it has allowed you to pass multiple conditions in the formula and returning the value, if the condition is true.
If({PROJECT.Customer\Customer Name} [1 to 2] = "An" and

ToText({PROJECT.Time\Year}) [1] = "2") or

({Project.Customer\CUSTOMER NAME} [1 to 2] = "Ja" and

ToText({PROJECT.Time\Year}) [1] = "2") Then

"Five star rating CUSTOMER"

Else

"1 star rating CUSTOMER"
This statement says that when any of the condition is true (before and after OR operator), then it will print Five star rating customer otherwise it will print 1 star rating customer.
This formula has been saved and then added to the body of the report under the structure tab as shown in the following images −
A new column in the report has been added with the rating of the customers as mentioned in the TEST formula.

    37 Lectures 
     2 hours 

 Neha Gupta

    61 Lectures 
     4.5 hours 

 Sasha Miller

    31 Lectures 
     32 mins

 Prof Krishna N Sharma

    35 Lectures 
     2 hours 

 Prof Krishna N Sharma

    24 Lectures 
     2 hours 

 Prof Krishna N Sharma
 Print
 Add Notes
 Bookmark this page
C# | Getting the list of Values of a SortedList object - GeeksforGeeks

01 Feb, 2019
SortedList.GetValueList Method is used to get the list of keys in a SortedList object.
Syntax:
public virtual System.Collections.IList GetValueList ();
Return Value: It returns an IList object containing the values in the SortedList object.
Below programs illustrate the use of above-discussed method:
Example 1:
// C# code for getting the values// in a SortedList objectusing System;using System.Collections;  class Geeks {      // Main Method    public static void Main(String[] args)    {          // Creating a SortedList of integers        SortedList mylist = new SortedList();          // Adding elements to SortedList        mylist.Add("1", "C++");        mylist.Add("2", "Java");        mylist.Add("3", "DSA");        mylist.Add("4", "Python");        mylist.Add("5", "C#");          // taking an IList and        // using GetValueList method        IList vlist = mylist.GetValueList();          // Prints the list of keys        Console.WriteLine("Value Stored in SortedList:");          // will print the values in Sorted Order        for (int i = 0; i < mylist.Count; i++)            Console.WriteLine(vlist[i]);    }}
Value Stored in SortedList:
C++
Java
DSA
Python
C#

Example 2:
// C# code for getting the values// in a SortedList objectusing System;using System.Collections;  class Geeks {      // Main Method    public static void Main(String[] args)    {          // Creating a SortedList of integers        SortedList mylist = new SortedList();          // Adding elements to SortedList        mylist.Add("First", "Ram");        mylist.Add("Second", "Shyam");        mylist.Add("Third", "Mohit");        mylist.Add("Fourth", "Rohit");        mylist.Add("Fifth", "Manish");          // taking an IList and        // using GetValueList method        IList vlist = mylist.GetValueList();          // Prints the list of keys        Console.WriteLine("Value Stored in SortedList:");          // will print the values in Sorted Order        for (int i = 0; i < mylist.Count; i++)            Console.WriteLine(vlist[i]);    }}
Value Stored in SortedList:
Manish
Ram
Rohit
Shyam
Mohit

Note:
The returned IList object is a read-only view of the values of the SortedList object. Modifications made to the underlying SortedList are immediately reflected in the IList.
The elements of the returned IList are sorted in the same order as the values of the SortedList.
This method is similar to the Values property but returns an IList object instead of an ICollection object.
This method is an O(1) operation.
Reference:
https://docs.microsoft.com/en-us/dotnet/api/system.collections.sortedlist.getvaluelist?view=netframework-4.7.2
CSharp-Collections-Namespace
CSharp-Collections-SortedList
CSharp-method
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
C# Dictionary with examples
C# | Delegates
C# | Method Overriding
C# | Abstract Classes
Difference between Ref and Out keywords in C#
Extension Method in C#
C# | Class and Object
C# | Replace() Method
C# | Constructors
Introduction to .NET Framework