Python Forum
Need help with my Python code (Multiplication)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with my Python code (Multiplication)
#2
You can use the string method split to return a list of the words in the string, using sep as the delimiter string.
sep defaults to whitespace
user_input = "7 * 7"
first_number, symbol, second_number = user_input.split()
Reply


Messages In This Thread
RE: Need help with my Python code (Multiplication) - by Yoriz - Oct-03-2021, 08:03 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Multiplication Table code alexsendlegames100 3 2,273 Jun-06-2022, 09:45 AM
Last Post: Gribouillis
  Try to solve GTG multiplication table problem. Frankduc 6 3,245 Jan-18-2022, 08:26 PM
Last Post: Frankduc
  List conversion and multiplication johnkyp 5 4,149 Jan-02-2020, 08:20 AM
Last Post: perfringo
  Matrix Multiplication Issue VIJENDRA 1 2,394 Dec-19-2019, 06:16 PM
Last Post: Gribouillis
  Multiplication between a list and a variable doug2019 2 2,803 Oct-08-2019, 04:10 AM
Last Post: doug2019
  Multiplication Table number margins CJ707 4 3,357 Sep-18-2019, 02:16 PM
Last Post: CJ707
  multiplication by successive addition Zebrol 1 4,376 Sep-14-2019, 05:37 PM
Last Post: ichabod801
  Tracing a multiplication table w/ Python trace() NationalRex22 0 2,184 Jun-11-2019, 03:31 AM
Last Post: NationalRex22
  float multiplication - unexpected output inesk 3 4,163 Dec-11-2018, 10:59 AM
Last Post: DeaD_EyE
  Print every multiplication of recursion Arontbt 4 4,641 Apr-24-2018, 10:01 PM
Last Post: Arontbt

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020