TASK 1: Python – Print exercises

1.How do you print the string “Hello, world!” to the screen?
Ans: Using sep and end Parameters is preferred way.

2.How do you print the value of a variable name which is set to “Syed Jafer” or Your name?
Ans: Note the Variable is case sensitive

Ho…


This content originally appeared on DEV Community and was authored by Pradeep Pep

1.How do you print the string “Hello, world!” to the screen?
Ans: Using sep and end Parameters is preferred way.
Image description

2.How do you print the value of a variable name which is set to “Syed Jafer” or Your name?
Ans: Note the Variable is case sensitive

Image description

How do you print the variables name, age, and city with labels “Name:”, “Age:”, and “City:”?
Ans: Using keyword sep="," brings in , between the Variable Name and Value itself, so avoid

Image description

4.How do you use an f-string to print name, age, and city in the format “Name: …, Age: …, City: …”?
Ans: To insert variables directly into the string used f-string
Also, you can assign values to multiple variables in a single line as seen in 1st line

Image description


This content originally appeared on DEV Community and was authored by Pradeep Pep


Print Share Comment Cite Upload Translate Updates
APA

Pradeep Pep | Sciencx (2025-04-20T02:26:33+00:00) TASK 1: Python – Print exercises. Retrieved from https://www.scien.cx/2025/04/20/task-1-python-print-exercises/

MLA
" » TASK 1: Python – Print exercises." Pradeep Pep | Sciencx - Sunday April 20, 2025, https://www.scien.cx/2025/04/20/task-1-python-print-exercises/
HARVARD
Pradeep Pep | Sciencx Sunday April 20, 2025 » TASK 1: Python – Print exercises., viewed ,<https://www.scien.cx/2025/04/20/task-1-python-print-exercises/>
VANCOUVER
Pradeep Pep | Sciencx - » TASK 1: Python – Print exercises. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/04/20/task-1-python-print-exercises/
CHICAGO
" » TASK 1: Python – Print exercises." Pradeep Pep | Sciencx - Accessed . https://www.scien.cx/2025/04/20/task-1-python-print-exercises/
IEEE
" » TASK 1: Python – Print exercises." Pradeep Pep | Sciencx [Online]. Available: https://www.scien.cx/2025/04/20/task-1-python-print-exercises/. [Accessed: ]
rf:citation
» TASK 1: Python – Print exercises | Pradeep Pep | Sciencx | https://www.scien.cx/2025/04/20/task-1-python-print-exercises/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.