-4
a= int(input('Multiplication: '))
print(end="")
b= int(input(' * '))
print(' = ',a*b,end="")


Is there a way to make an input statement in 1 line to get the value of a and b {a] * {b} =

I'm trying to make the input in line with the text and a and b are in between a string

Mad Physicist
  • 107,652
  • 25
  • 181
  • 264

1 Answers1

1

You can try the following code to get the value of a and b when entering them on the same line and print the desired result.

a, b = map(int, input().split())
result = a * b
print(f"Multiplication: {a} * {b} = {result}")
Kepler452B
  • 130
  • 1
  • 1
  • 9
  • like f string for print , is there a way to do that for input – MoohaYT_Art Aug 08 '23 at 17:18
  • @MoohaYT_Art You can try the code by following the link below. It allows you to enter input and print the results in just 1 line. You will need to add the msvcrt library and will have to do extra work to remove the line break when pressing enter: https://ideone.com/sbRJVA – Kepler452B Aug 09 '23 at 16:47