Python Forum
How do I do this? Switch Case?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I do this? Switch Case?
#1
Hello,

Im attempting to generate a random number as such:

import random
rnumber = random.randint(1, 10)
then I want to take that random number and have different things happen based on its outcome. In my old language I would have used a simple Select Case. I looked up switcher but im confused how to apply it here.

Thanks,
Matt
Reply


Messages In This Thread
How do I do this? Switch Case? - by mstichler - Jun-04-2020, 09:32 PM
RE: How do I do this? Switch Case? - by menator01 - Jun-04-2020, 09:57 PM
RE: How do I do this? Switch Case? - by mstichler - Jun-04-2020, 10:01 PM
RE: How do I do this? Switch Case? - by deanhystad - Jun-04-2020, 10:22 PM
RE: How do I do this? Switch Case? - by snippsat - Jun-05-2020, 10:27 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  switch case not working Username0089098 1 714 Apr-09-2023, 05:49 AM
Last Post: buran
  Switch case or match case? Frankduc 9 4,615 Jan-20-2022, 01:56 PM
Last Post: Frankduc
  best way to use switch case? korenron 8 3,059 Aug-18-2021, 03:16 PM
Last Post: naughtyCat
  How to use switch/case in python? newbieguy 9 4,147 Nov-08-2019, 11:35 AM
Last Post: newbieguy
  switch limitations MuntyScruntfundle 3 2,415 Jan-27-2019, 06:11 PM
Last Post: aakashjha001
  How to write switch case statement in Python pyhelp 9 9,327 Nov-11-2018, 08:53 PM
Last Post: woooee

Forum Jump:

User Panel Messages

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