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

Hi Nuthakki,

No. To print a number, do not use quotes:

print(5)
print(10.5)

Quotes are only for text. If you write "5", Python treats it as a string, not a 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 Steve,

Use the modulo operator %. It gives the remainder after division.

Example:

print(14 % 3)  # 2

So 14 % 3 is 2, because 14 divided by 3 leaves 2 leftover.

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

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

Hi Akash,

Coding matters because it lets you tell a computer what to do, so you can solve problems faster and automate boring tasks.

It also helps you build useful things like websites, apps, games, and tools, and it is a skill used in many careers.

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 Sujan,

Because in Python, # means comment. Anything after # on that line is only a note for humans, so Python ignores it when running the code.

Example:

# this will be skipped
print(34.0)  # this part is also skipped

Only print(34.0) runs.

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 guerfi,

There is no difference. f"..." and F"..." both mean an f-string, and they work the same.

Example:

name = "Alice"
print(f"Hi {name}")
print(F"Hi {name}")

Both print the same output.

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

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

Hi Shashank,

Datatypes tell the computer what kind of value something is, like a number, text, or true/false. This helps the language know what operations make sense.

Common Python datatypes:

  • int for whole numbers like 5

  • float for decimals like 5.6

  • str for text like "hello"

  • bool for True or False

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 temidayo,

3.2 is a float, which means a number with a decimal point.

So:

  • 34 is an int

  • "dayo" is a str

  • 3.2 is a float

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 Harit,

Yes. Put \n inside the string where you want a new line.

Example:

print("Hello\nHow are you?")

This prints Hello on one line and How are you? on the next.

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 Harit,

Yes. Put \n inside the string where you want a new line.

Example:

print("Hello\nHow are you?")

This prints Hello on one line and How are you? on the next.

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

Good question! The punctuation you add to a string, like a full-stop (period) or other marks, doesn’t affect the code itself, but it will change the actual content of the string.

For example, if you write:

print("This is a string.")

the output will include the period, showing: This is a string. However, if you write:

print("This is a string")

then the output will be This is a string without the period. The choice of punctuation is up to you and what you want to convey in that string.

Let me know if you have more questions!

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