Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random Choice Operations
#1
The problem here is i successfully pick a random number from list but when i want o divide that number to 2 just like last lane of my code python chooses other random number and divide that number to 2
Thanks in advance for answers.


forum. ie.
import random
numberList = [2,4,6,8,10]
random_num = random.choice(numberList)
print(random.choice(numberList))
print("result is : " + str(random_num))/2 
Reply


Messages In This Thread
Random Choice Operations - by Souls99 - Jul-31-2020, 08:18 PM
RE: Random Choice Operations - by Yoriz - Jul-31-2020, 08:34 PM
RE: Random Choice Operations - by Souls99 - Jul-31-2020, 09:18 PM
RE: Random Choice Operations - by Yoriz - Jul-31-2020, 09:27 PM
RE: Random Choice Operations - by Souls99 - Jul-31-2020, 09:33 PM
RE: Random Choice Operations - by Yoriz - Jul-31-2020, 09:54 PM
RE: Random Choice Operations - by Souls99 - Jul-31-2020, 10:37 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  combobox_callback(choice choice part of openfile name (kind of dependency) janeik 9 1,660 Sep-10-2023, 10:27 PM
Last Post: janeik
  Replicate Excel operations with Python Lumberjack 3 1,941 May-10-2022, 01:44 AM
Last Post: Lumberjack
  random.choice HELP samuelbachorik 4 2,400 Aug-18-2021, 03:24 PM
Last Post: naughtyCat
  Program demonstrates operations of bitwise operators without using bitwise operations ShawnYang 2 1,883 Aug-18-2021, 03:06 PM
Last Post: deanhystad
  Unable to use random.choice(list) in async method spacedog 4 3,617 Apr-29-2021, 04:08 PM
Last Post: spacedog
  Help with a random.randint choice in Python booponion 5 2,940 Oct-23-2020, 05:13 PM
Last Post: deanhystad
  trying to input a variable using random.choice python63 9 3,841 Aug-13-2020, 05:37 PM
Last Post: python63
  Create bot to automate operations in IQ Option JonatasCavalini 0 13,160 Jul-19-2020, 02:23 AM
Last Post: JonatasCavalini
  Two operations in two ranges salwa17 3 2,276 Jun-22-2020, 04:15 PM
Last Post: perfringo
  random.choice() takes two positional arguments, but three were given. ShakeyPakey 5 12,036 May-31-2020, 03:13 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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