Question :
In the GitHub repository, Infinity-AI(Infinite Learn and Grow)/30-days-code inside the Day-1 folder create your_name.py file as defined in the readme.md file. - Write a python code to take input from the user as username and country name. Also, Display both on screen.
- Perform the below operation (At least two of them) on any two integer operands and then print the output on the screen: Addition(+), Subtraction (-), Multiplication(*), Modulus(%), Division(/), Exponential (**), floor division operator(//).
Solution :
First of all, we define a variable that stores our input. After that, we need to get input from the user so we use the input function to get the input from the user. In our case, we need to input in a string so we use the data-type str.
Now we print the value which is input by the user. For that, we use the print function to print.
Now to get input the country name and print the country name the same syntax is applied.
We want two numbers that are input by the user so firstly we define two variables NUM1 and NUM2 which stores the value of input numbers.
After that to get input from the user we use the input function. We want an integer value as input so we will use int datatype.
If you don't want to get input from the user then assign the value by yourself.
Now we have to input values so now we can perform the operations mentioned in the question and to store the value of the result we need to declare one more variable which is initially 0. Then we perform operations and print the output.
Thank you