print()

print() అంటే ఏమిటి?

Pythonలో మనకు కావలసిన text, number లేదా informationను screenపై చూపించడానికి print() function ఉపయోగిస్తాము.

print() ఎందుకు ఉపయోగిస్తాము?

Program run అయినప్పుడు userకు message లేదా result చూపించాలి. అలాంటి సందర్భాల్లో print() చాలా ఉపయోగకరంగా ఉంటుంది.

print() ఎలా పనిచేస్తుంది?

print()లో మనం చూపించాలనుకున్న valueను parentheses మధ్యలో రాస్తాము. Textను సాధారణంగా quotation marks మధ్యలో రాస్తాము.

ఉదాహరణకు, print("Hello") code screenపై Hello అనే textను చూపిస్తుంది. ప్రతి print() statement సాధారణంగా కొత్త lineలో outputను చూపిస్తుంది.

print() ఎక్కడ ఉపయోగపడుతుంది?

  • Userకు welcome message చూపించడానికి
  • Program resultను చూపించడానికి
  • Debugging సమయంలో valuesను పరిశీలించడానికి
  • Instructions లేదా status messages చూపించడానికి

ప్రధాన నియమాలు

  • Function nameను సరైన విధంగా printగా రాయాలి.
  • Parentheses () తప్పనిసరిగా ఉండాలి.
  • Textను quotation marks మధ్యలో రాయాలి.
  • Pythonలో uppercase మరియు lowercase letters వేర్వేరుగా పరిగణించబడతాయి.

Simple Explanation

print()ను Pythonలో ఒక చిన్న speakerలా ఊహించుకోవచ్చు. మనం దానికి ఏదైనా text లేదా value ఇస్తే, అది ఆ విషయాన్ని screenపై చూపిస్తుంది.

print("Good Morning")లో print() చూపించే function, "Good Morning" చూపించాల్సిన text. ఒకటి కంటే ఎక్కువ print() statements ఉంటే, అవి సాధారణంగా వేర్వేరు linesలో కనిపిస్తాయి.

Real-Life Example

ఒక railway display board ప్రయాణికులకు Train Arriving లేదా Platform 2 అని చూపిస్తుంది. అలాగే Python programలో screenపై message చూపించడానికి print() ఉపయోగిస్తాము.

Code Examples

ఒక textను screenపై చూపించడం

print("Hello, Python!")

ఈ code screenపై Hello, Python! అనే messageను చూపిస్తుంది.

Hello, Python!

Multiple print() statements

print("Python")
print("is easy")
print("to learn")

ఇక్కడ మూడు print() statements ఉన్నాయి. ప్రతి statement outputను కొత్త lineలో చూపిస్తుంది.

Python
is easy
to learn

Text మరియు numberను చూపించడం

print("Age:", 20)
print("Score:", 95)

print()లో comma ఉపయోగించి textతో పాటు numberను కూడా చూపించవచ్చు. Text మరియు number మధ్య Python సాధారణంగా ఒక space ఉంచుతుంది.

Age: 20
Score: 95

Line-by-Line Explanation

print(“Hello, Python!”)
ఈ line print() functionను ఉపయోగిస్తుంది. Quotation marks మధ్య ఉన్న textను Python screenపై చూపిస్తుంది. Program run చేసినప్పుడు Hello, Python! కనిపిస్తుంది.
print(“Python”)
ఈ line Python అనే textను screenపై చూపిస్తుంది. ఇది మొదటి output line అవుతుంది.
print(“is easy”)
ఈ line is easy అనే textను చూపిస్తుంది. ప్రతి కొత్త print() సాధారణంగా కొత్త lineను ప్రారంభిస్తుంది.
print(“to learn”)
ఈ line to learn అనే textను చూపిస్తుంది. అందువల్ల మొత్తం output మూడు linesలో కనిపిస్తుంది.
print(“Age:”, 20)
ఈ lineలో comma ద్వారా text మరియు numberను ఒకే సమయంలో చూపిస్తున్నాము. Python Age: మరియు 20 మధ్య ఒక space ఉంచి output ఇస్తుంది.
print(“Score:”, 95)
ఈ line Score: textతో పాటు 95 numberను screenపై చూపిస్తుంది.

Try It

Try this Python code:

Example

print("My name is Alex")
print("I am learning Python")

Try It Yourself »

Practice

Practice: మీ పేరు, మీరు నివసించే city, మీకు ఇష్టమైన hobbyలను మూడు వేర్వేరు print() statements ఉపయోగించి చూపించండి.

Hint: ప్రతి information కోసం ఒక ప్రత్యేక print() line రాయండి. Textను quotation marks మధ్యలో ఉంచండి.

Common Mistakes

print తర్వాత parentheses రాయకపోవడం, ఉదాహరణకు print "Hello".
Pythonలో సరైన syntax print("Hello"). print()లో parentheses తప్పనిసరిగా ఉండాలి.
Textకు quotation marks ఉపయోగించకపోవడం, ఉదాహరణకు print(Hello).
Textను double quotes లేదా single quotes మధ్యలో రాయాలి. ఉదాహరణ: print("Hello").
Print() అని uppercase Pతో రాయడం.
Python case-sensitive. Function nameను lowercaseలో print()గా మాత్రమే రాయాలి.
Parentheses లేదా quotation markను మూసివేయడం మర్చిపోవడం.
Opening మరియు closing symbols జతగా ఉన్నాయో చూసుకోండి. సరైన code: print("Hello").

Interview Questions

Pythonలో print() function ఎందుకు ఉపయోగిస్తారు?

Answer: Screenపై text, numbers లేదా ఇతర outputను చూపించడానికి print() function ఉపయోగిస్తారు.

print()లో textను ఎలా రాయాలి?

Answer: Textను quotation marks మధ్యలో రాయాలి. ఉదాహరణ: print("Welcome").

రెండు print() statements ఉంటే output ఎలా కనిపిస్తుంది?

Answer: సాధారణంగా ప్రతి print() statement outputను కొత్త lineలో చూపిస్తుంది.

print()లో text మరియు number రెండింటినీ చూపించవచ్చా?

Answer: అవును. Comma ఉపయోగించి రెండింటినీ చూపించవచ్చు. ఉదాహరణ: print("Age:", 20).

Exam Questions

క్రింది code output ఏమిటి? print("Python")

Answer:

Output: Python

Pythonలో screenపై message చూపించడానికి ఉపయోగించే function ఏది?

Answer:

print() function.

క్రింది codeలో తప్పు ఏమిటి? Print("Hello")

Answer:

Function name lowercaseలో ఉండాలి. సరైన code: print("Hello").

క్రింది code output ఏమిటి? print("Age:", 20)

Answer:

Output: Age: 20

Quick Revision

  • print() screenపై output చూపించడానికి ఉపయోగిస్తాము.
  • Textను quotation marks మధ్యలో రాయాలి.
  • print()లో parentheses తప్పనిసరి.
  • ప్రతి print() సాధారణంగా కొత్త lineలో output చూపిస్తుంది.
  • Text మరియు numberను comma ద్వారా ఒకే print()లో చూపించవచ్చు.
  • Python case-sensitive కాబట్టి print()ను lowercaseలో రాయాలి.

Test Your Knowledge

Take a short quiz based on this lesson.

10 Questions • Results
Scroll to Top