Python Forum
Use a block of code only one time
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use a block of code only one time
#12
Then you need to make sure idx is set differently for ocean and desert. From your original post it seems you are not setting idx at all. So you need to set that using a conditional based on input_value.

if input_vale == 'desert':
    idx = 0
else:
    idx = 1
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Use a block of code only one time - by rlinux57 - Sep-18-2018, 10:45 AM
RE: Use a block of code only one time - by rlinux57 - Sep-18-2018, 05:38 PM
RE: Use a block of code only one time - by rlinux57 - Sep-18-2018, 07:22 PM
RE: Use a block of code only one time - by rlinux57 - Sep-19-2018, 06:02 AM
RE: Use a block of code only one time - by rlinux57 - Sep-20-2018, 08:41 AM
RE: Use a block of code only one time - by ichabod801 - Sep-20-2018, 02:03 PM
RE: Use a block of code only one time - by rlinux57 - Sep-20-2018, 06:37 PM
RE: Use a block of code only one time - by rlinux57 - Sep-21-2018, 12:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python multiple try except block in my code -- can we shorten code mg24 10 6,350 Nov-10-2022, 12:48 PM
Last Post: DeaD_EyE
  "If Len(Word) == 0" Code Block in Pig Latin Program new_coder_231013 3 2,124 Jan-02-2022, 06:03 PM
Last Post: deanhystad
  Try,Except,Else to check that user has entered either y or n (Code block pasted) RandomNameGenerator 3 2,364 Jun-29-2021, 08:21 PM
Last Post: RandomNameGenerator
  Assistance with running a few lines of code at an EXACT time nethatar 5 3,339 Feb-24-2021, 10:43 PM
Last Post: nilamo
  Stumped by my own code (ratio & epoch-time calculation). MvGulik 2 2,179 Dec-30-2020, 12:04 AM
Last Post: MvGulik
  Code taking too much time to process ErPipex 11 5,016 Nov-16-2020, 09:42 AM
Last Post: DeaD_EyE
  What is the run time complexity of this code and please explain? samlee916 2 2,329 Nov-06-2020, 02:37 PM
Last Post: deanhystad
  The count variable is giving me a hard time in this code D4isyy 2 1,997 Aug-09-2020, 10:32 PM
Last Post: bowlofred
  Having a hard time combining two parts of code. Coozeki 6 3,156 May-10-2020, 06:50 AM
Last Post: Coozeki
  Block of code, scope of variables and surprising exception arbiel 8 3,473 Apr-06-2020, 07:57 PM
Last Post: arbiel

Forum Jump:

User Panel Messages

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