0% found this document useful (0 votes)
2 views3 pages

Course 4

The document introduces the basics of Python programming, focusing on the input() and print() functions. The input() function allows users to enter data, which is treated as a string unless converted to a numerical type, while the print() function is used to display values or messages on the screen. It also highlights the importance of combining text and numerical values in output messages.

Uploaded by

belhadi.ttl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Course 4

The document introduces the basics of Python programming, focusing on the input() and print() functions. The input() function allows users to enter data, which is treated as a string unless converted to a numerical type, while the print() function is used to display values or messages on the screen. It also highlights the importance of combining text and numerical values in output messages.

Uploaded by

belhadi.ttl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Basics in Python programming:

input () and print () function


Introduction:
For executing a program, we have to provide a data to it and can extract or display a result that is
obtained.

Entries :
The input() function allows the user to input data using keyboard and to assign it to variables.

how does the input() function work in Python?

We use input():
Remark:
The data entered by the input function is a string type. If you want to obtain a number (and not a
string), you will have to convert or cast these data into an integer or float.

Output :
print() function aims to display values or messages on the screen.
This function can be used in a program to include a message followed by the result or just the
result in the parentheses.
If we display a variable, its value is displayed.

To view messages that include both text and numerical values.


Exercises:

Note: The characters and numbers displayed in bold represent the numbers entered by the user on the
keyboard.

You might also like