Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random Choice Operations
#3
still python chooses new number and divide the new number , in my code i successfully divide the random number to 2 but the problem it chooses new number i need the first chosen random number look i changed the code as u said
forum. ie.
numberList = [2,4,6,8,10]
random_num = random.choice(numberList)
print("additional: ", + random.choice(numberList))

input("division 2")
input("Subtract the first number you have chosen")
print("Hmmm  let me think")
time.sleep(2)
print("Result issss")
print(f'result is : {random_num/2}')
result
additional: 10
division 2
Subtract the first number you have chosen
Hmmm let me think
Result issss
result is : 1.0
last result is 1.0 which should be 5 because additional is first random choice number which is 10 so our code sohuld give us 5 but it didnt
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,581 Sep-10-2023, 10:27 PM
Last Post: janeik
  Replicate Excel operations with Python Lumberjack 3 1,897 May-10-2022, 01:44 AM
Last Post: Lumberjack
  random.choice HELP samuelbachorik 4 2,352 Aug-18-2021, 03:24 PM
Last Post: naughtyCat
  Program demonstrates operations of bitwise operators without using bitwise operations ShawnYang 2 1,846 Aug-18-2021, 03:06 PM
Last Post: deanhystad
  Unable to use random.choice(list) in async method spacedog 4 3,544 Apr-29-2021, 04:08 PM
Last Post: spacedog
  Help with a random.randint choice in Python booponion 5 2,898 Oct-23-2020, 05:13 PM
Last Post: deanhystad
  trying to input a variable using random.choice python63 9 3,760 Aug-13-2020, 05:37 PM
Last Post: python63
  Create bot to automate operations in IQ Option JonatasCavalini 0 12,922 Jul-19-2020, 02:23 AM
Last Post: JonatasCavalini
  Two operations in two ranges salwa17 3 2,257 Jun-22-2020, 04:15 PM
Last Post: perfringo
  random.choice() takes two positional arguments, but three were given. ShakeyPakey 5 11,909 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