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 Nayablal Vishwakarma,

A set is mutable, but the items inside the set must be immutable.

So you can change the set by adding or removing items, but each item you put inside must be something that cannot change, like an int, float, str, or tuple.

Example:

s = {1, 2}
s.add(3)      # allowed
s.remove(1)   # allowed

But you cannot add a list, because a list can change:

s.add([4, 5])   # TypeError: unhashable type: 'list'

The reason is simple: sets use hashing to store items, and hashing only works safely when the item itself cannot change.

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 Revathi Kasireddy,

print is not a variable. It is a built-in function that shows output on the screen.

A variable is something like greeting that stores a value:

greeting = "Merry Christmas"
print(greeting)   # prints the value inside greeting

So print() displays a value, and the variable is what holds the value.

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 王宇杰,

In Python, the / operator always returns a float, so 25 / 5 becomes 5.0 even though it is a whole number.

If you want an integer result, use //:

print(25 // 5)  # 5

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 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 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 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.
Sarthak Baral
Expert
last year
Sarthak Baral answered

Hi Jogblackhole,

In Python, () is mainly used to call a function and pass values into it.

Example:

print("Hello")

Here, print() is the function, and the text inside () is what it should print.

() is also used to group math so Python does that part first:

(2 + 3) * 4

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

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

Hi Rashina,

In Python, you can check this using isinstance():

value = "Hello"

if isinstance(value, str):
    print("It is a string")
else:
    print("It is not a string")

Just replace value with the variable you want to test.

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

Python
This question was asked as part of the Number Guessing Game course.
Sarthak Baral
Expert
last year
Sarthak Baral answered

Hi Nafees,

Start with the basics and move step by step, practicing each topic with small programs.

A simple order to follow is:

  • Variables, numbers, strings

  • If else, loops

  • Functions

  • Lists, tuples, sets, dictionaries

  • File handling

  • Errors and exceptions

  • OOP (classes and objects)

  • Small projects to practice

The key is to write code every day, even 20 minutes, and build tiny projects like a calculator, quiz, or to-do list.

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

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