Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Switch case or match case?
#10
(Jan-20-2022, 01:32 PM)snippsat Wrote:
(Jan-20-2022, 01:22 PM)Frankduc Wrote: ant say what is wrong still trying to understand how it works. Wink
This only work in Python 3.10 as structured pattern matching was new there,error message indicate that you run version less than this.
To recreate your error message.
Output:
# Running Python 3.10 G:\div_code\match_stuff λ py -3.10 match2.py (1) Calculate two numbers (Q) Quit Enter your choice: 1 Select operation +, -, *, /: - Fist number: 100 Second number: 50 100 - 50 = 50 (1) Calculate two numbers (Q) Quit Enter your choice: q # Now try in Python 3.9 G:\div_code\match_stuff λ py -3.9 match2.py File "G:\div_code\match_stuff\match2.py", line 13 match us_in: ^ SyntaxError: invalid syntax

I am using online compilers, that explain. I am waiting to see what compiling program the school will suggest . I dont want to be force to reinstall some other compiler if i pick the wrong one. Windows already messy enough.
Thanks anyway ill keep the code and retry it in february.
Reply


Messages In This Thread
Switch case or match case? - by Frankduc - Jan-19-2022, 06:14 PM
RE: Switch case or match case? - by deanhystad - Jan-19-2022, 07:00 PM
RE: Switch case or match case? - by Frankduc - Jan-19-2022, 07:05 PM
RE: Switch case or match case? - by menator01 - Jan-19-2022, 07:50 PM
RE: Switch case or match case? - by Frankduc - Jan-19-2022, 08:09 PM
RE: Switch case or match case? - by deanhystad - Jan-19-2022, 07:37 PM
RE: Switch case or match case? - by snippsat - Jan-20-2022, 06:28 AM
RE: Switch case or match case? - by Frankduc - Jan-20-2022, 01:22 PM
RE: Switch case or match case? - by snippsat - Jan-20-2022, 01:32 PM
RE: Switch case or match case? - by Frankduc - Jan-20-2022, 01:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Good way to ignore case when searching elements? Winfried 1 340 Apr-25-2024, 12:39 PM
Last Post: menator01
  switch case not working Username0089098 1 747 Apr-09-2023, 05:49 AM
Last Post: buran
  unittest generates multiple files for each of my test case, how do I change to 1 file zsousa 0 1,023 Feb-15-2023, 05:34 PM
Last Post: zsousa
  What colon (:) in Python mean in this case? Yapwc 4 2,336 Dec-28-2022, 04:04 PM
Last Post: snippsat
  Merging two Data Frame on a special case piku9290dgp 0 1,125 Mar-02-2022, 10:43 AM
Last Post: piku9290dgp
  best way to use switch case? korenron 8 3,131 Aug-18-2021, 03:16 PM
Last Post: naughtyCat
  Logstash - sending Logstash messages to another host in case of Failover in python Suriya 0 1,725 Jul-27-2021, 02:02 PM
Last Post: Suriya
  Help: write 'case' with Python ICanIBB 2 1,936 Jan-27-2021, 09:39 PM
Last Post: Larz60+
  Case sensitive checks kam_uk 2 2,090 Nov-30-2020, 01:25 AM
Last Post: bowlofred
  case transparent names in configpaser Skaperen 4 2,708 Oct-02-2020, 01:16 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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