• Slider Banner

    The Programming World

    Learn about top programming languages, tools and frameworks.

    Read more
  • Slider Banner

    Certification MCQ

    Practice for certification from 1000+ multiple choice questions.

    Read more
  • Slider Banner

    Prepare for Technical Interview

    Over 1 Million+ interview questions for different technical profiles.

    Read more

list the differences between supervised and unsupervised machine learning.

Supervised learning: Supervised learning is the learning of the model where with input variable ( say, x) and an output variable (say, Y) and an algorithm to map the input to the output.

That is, Y = f(X)

Unsupervised Learning: Unsupervised learning is where only the input data (say, X) is present and no corresponding output variable is there.

Here are the differences:

What is Data Science?

Data Science is a blend of various tools, algorithms, and machine learning principles with the goal to discover hidden patterns from the raw data.

Data science is a multi-disciplinary field that uses scientific methods, processes, algorithms and systems to extract knowledge and insights from structured and unstructured data. 

How is Python executed?

Python files are compiled to bytecode, which is then executed by the host. Python automatically compiles your script to compiled code, so called byte code, before running it.

When a module is imported for the first time, or when the source is more recent than the current compiled file, a .pyc file containing the compiled code will usually be created in the same directory as the .py file. When you run the program next time, Python uses this file to skip the compilation step.
 

Can you write an efficient code to count the number of capital letters in a file?

Suppose file contain text "Hello Capital World!" 

with open('/mypath/mycapitalfile.txt') as countletter:
    count = 0
    file_text = countletter.read()
    
    for character in file_text:
        if character.isupper():
            count += 1

print("Total Capital Letters in file:", count)  

This will print, Total Capital Letters in file: 3

Another efficient way of doing this:

What are local variables and global variables in Python?

Global Variables: Variables declared outside a function or in global space are called global variables. These variables can be accessed by any function in the program.

Local Variables: Any variable declared inside a function is known as a local variable. This variable is present in the local space and not in the global space.

Example:

Subscribe to