Ask Programiz - Human Support for Coding Beginners

Explore questions from fellow beginners answered by our human experts. Have some doubts about coding fundamentals? Enroll in our course and get personalized help right within your lessons.

  • All
  • Python
  • C
  • Java
  • CPP
  • SQL
  • JS
  • HTML
  • CSS
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Jacob,

== compares values after JavaScript may convert one type to another (type coercion).
=== compares both the value and the type, with no conversion.

Example:

5 == "5"    // true (string "5" is converted to number)
5 === "5"   // false (number vs string)

Most of the time, === is safer because it avoids surprising conversions.

If you have more questions, I am here to help 😊

JS
This question was asked as part of the Learn JavaScript Basics course.
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi 睿宏,

That happens because printf("%f", ...) shows 6 digits after the decimal by default, so 78.32 becomes 78.320000.

If you want only 2 decimal places, set the precision like this:

printf("%.2f", number);

If you have more questions, I am here to help 😊

C
This question was asked as part of the Learn C Programming course.
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Tlachi,

Because pen_number is a number, and "Pens for each student: " is a string. In Python, you cannot join a string and a number using + unless you convert the number to a string first.

So this works:

print("Pens for each student: " + str(pen_number))

Another easy option is to use commas, which avoids str():

print("Pens for each student:", pen_number)

If you have more questions, I am here to help 😊

Python
This question was asked as part of the Getting started with Python course.
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Gulalai,

C++ helps because it lets you work closer to how the computer actually runs programs.

  • You learn how data is stored in memory using things like variables and arrays.

  • You can use pointers to see and work with memory addresses.

  • C++ code gets compiled into machine code, so it is easier to connect your code to what the CPU executes.

So C++ shows you what is happening under the hood more than many high-level languages.

If you have more questions, I am here to help 😊

C++
This question was asked as part of the Learn C++ Basics course.
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Giant,

It depends on what the author or course means by space complexity.

  • Auxiliary space means extra memory the algorithm uses, not counting the input itself.

  • Space complexity often means total space used, which can include both input space + auxiliary space.

In many algorithm discussions, people focus on auxiliary space because the input size is usually fixed by the problem, and they want to compare how much extra memory different solutions need.

If you have more questions, I am here to help 😊

Python
This question was asked as part of the Complexity Calculation course.
Kelish Rai
Expert
last year
Kelish Rai answered

Hi Charan,

You can use both in Python, but a single string must start and end with the same type of quote.

These are fine:

text1 = "Hello"
text2 = 'Hello'

You can mix them inside the string to avoid escaping:

msg1 = "It's a sunny day"
msg2 = 'She said, "Keep learning."'

But this is not valid because the quotes do not match:

text = "Hello'

If you have more questions, I am here to help 😊

Python
This question was asked as part of the Getting started with Python course.
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Youssef,

An immediate child is an element that is directly inside another element, with nothing in between.

Example:

  • Item

  • is the immediate child of
      because it is directly inside it.

      If it was like this:

      • Item

      Then

    • is not an immediate child of
        . The
        is.

        If you have more questions, I am here to help 😊

  • HTML
    This question was asked as part of the Learn HTML course.
    Abhay Jajodia
    Expert
    last year
    Abhay Jajodia answered

    Hi samharid,

    Because headings like

    to
    are meant to show the structure of the page, not just styling. They tell the browser and screen readers what the main topics are.

    If you use headings only to make text look big, the page structure becomes confusing. A better way is to keep normal text and make it bold or bigger using CSS.

    Example:

    This is normal text, just styled.

    .big {
      font-size: 24px;
      font-weight: bold;
    }
    

    If you have more questions, I am here to help 😊

    HTML
    This question was asked as part of the Learn HTML course.
    Abhay Jajodia
    Expert
    last year
    Abhay Jajodia answered

    Hi Aarav,

    A macro is a text replacement done before compilation using #define. It does not create a real variable in memory.

    #define PI 3.14
    

    A variable is a real storage location in memory with a type, and its value can change while the program runs.

    float pi = 3.14;
    

    So the simple difference is: macros are replaced in the code, variables store values in memory.

    If you have more questions, I am here to help 😊

    C
    This question was asked as part of the Learn C Programming course.
    Abhay Jajodia
    Expert
    last year
    Abhay Jajodia answered

    Hi Luna,

    In Python, spaces at the start of a line matter because Python uses indentation to understand code blocks.

    So if you add extra spaces before a line like print("Hello") when it is not inside an if, for, while, or a function, Python thinks you are starting a block and throws an indentation error.

    Example of correct indentation:

    if True:
        print("Hello")
    

    If you have more questions, I am here to help 😊

    Python
    This question was asked as part of the Getting started with Python course.