OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

why does "int" come before "input"? I would like to understand the logic of this code [closed]

  • Thread starter Thread starter Z3R0
  • Start date Start date
Z

Z3R0

Guest
My teacher gave me this question: make a program that reads an integer and prints it. So I found this code:

Code:
integer_number = int(input("Enter an integer: "))

print("You entered:", integer_number)

I would like to understand why the function: "int" comes first than "input"

I expected the "input" function to be first than the "int" function since "input" has the function of requesting information from the user so that he can fill it in and the "int" converts a given string to an integer.
<p>My teacher gave me this question: make a program that reads an integer and prints it.
So I found this code:</p>
<pre class="lang-py prettyprint-override"><code>integer_number = int(input("Enter an integer: "))

print("You entered:", integer_number)
</code></pre>
<p>I would like to understand why the function: "int" comes first than "input"</p>
<p>I expected the "input" function to be first than the "int" function since "input" has the function of requesting information from the user so that he can fill it in and the "int" converts a given string to an integer.</p>
 

Latest posts

A
Replies
0
Views
1
Aarif Hussain A Nassar
A
F
Replies
0
Views
1
Fahmi Nur Fachrurozi
F
Top