DEV Community

technonotes-hacker
technonotes-hacker

Posted on

Python - Print () - Interview Questions

  • Format in next line

Image description

  • Do you need "quotation marks" when printing numbers? --> No

Image description

  • Multiplication

Image description

  • How do you print the value of a variable name which is set to “Syed Jafer” or Your name?

Image description

  • How do you print the variables name, age, and city with labels “Name:”, “Age:”, and “City:”?

Image description

Image description

  • How do you concatenate and print the strings greeting (“Hello”) and target (“world”) with a space between them?

Image description

  • How do you print three lines of text with the strings “Line1”, “Line2”, and “Line3” on separate lines?

Image description

  • How do you print the string He said, "Hello, world!" including the double quotes?

Image description

  • How do you print the string C:\Users\Name without escaping the backslashes?

Image description

  • How do you print the string “Hello” followed by a space, and then print “world!” on the same line?

Image description

  • How do you print the value of a boolean variable is_active which is set to True?

TBD

  • How do you print the string “Hello ” three times in a row?

Image description

  • How do you print the sentence The temperature is 22.5 degrees Celsius. using the variable temperature?

Image description

  • How do you print the value of pi (3.14159) rounded to two decimal places in the format The value of pi is approximately 3.14?

Image description

  • How do you print the words “left” and “right” with “left” left-aligned and “right” right-aligned within a width of 10 characters each?

Image description

Image description

Image description

Image description

Image description

with open ( " file.txt " , "w" ) as f;
print ( file is to open " , file=f)

  • prints only blank line.
  • to determine joints element with as " it will join ".

Top comments (0)