Computer Science, asked by praneelgirish70, 4 months ago

num=int(input(“Enter a number”))

n1=num%10

n2=num//10

if n1== n2:

print(“Hello”)

elif n1>n2:

print(“Good Bye”)

else:

print(“Hi”)​

Answers

Answered by mohamedshaheedh2712
1

Explanation:

Calculators work best when a human provides equations for the computer to solve. We’ll start writing our program at the point where the human enters the numbers that they would like the computer to work with.

To do this, we’ll use Python’s built-in input() function that accepts user-generated input from the keyboard. Inside of the parentheses of the input() function we can pass a string to prompt the user. We’ll assign the user’s input to a variable.

For this program, we would like the user to input two numbers, so let’s have the program prompt for two numbers. When asking for input, we should include a space at the end of our string so that there is a space between the user’s input and the prompting string.

number_1 = input('Enter your first number: ')

number_2 = input('Enter your second number: ')

After writing our two lines, we should save the program before we run it. We can call this program calculator.py and in a terminal window, we can run the program in our programming environment by using the command python calculator.py. You should be able to type into the terminal window in response to each prompt.

Similar questions