Command basics/ python strings vs integers

What is the differences between “1” and 1?

Is “1” known as outcome
1 known as input

Hey there, … the difference I see there is just their data types , one is a string and the other an integer… or what differences did you have in mind?

2 Likes

Thanks so much Kyle. I’m just a beginner and just learning the basis. Can you send any link to me that can improve my knowledge in python. Cheers!

this is a good start Tutorial
then check real python

This is just a guess on my part, but perhaps you are asking about what happens when you enter a number after a Python program prompts you for input. For some guidance regarding that process, you can consult the official documentation on the built-in input() function. See input(prompt).

Note that the documentation states, in part:

The function then reads a line from input, converts it to a string …

Therefore, if you enter 7 at the prompt, the input() function would return the value "7", which is a string. In order to use it as a number for some mathematical computation, you would need to convert it for that purpose. Here is an example:

num = int(input("Enter an integer to be squared: "))
print(f"{num} squared is {num * num}.")

Here is some example input and output during a run of the program:

Enter an integer to be squared: 7
7 squared is 49.

One resource for learning Python is The Python Tutorial. A search will reveal many others.