0
How to block input?
Hi i dont know how to block input. Like: i = input() if int(i) == int(1): print("hahaahha") c = input() elif int(c) == int(2): print("hahahhaahHHH") how to block in code input if hmm like randomly choose 2. In random1 is input and random2 is input. if randomly choose random2 how to block random1 input? Dont know how to ask correctly
6 Answers
+ 1
i don't quite understand what you want to achieve.
is this right:
- choose door 1 or 2
- if the door is 1 then you 'run' or 'die'
- if the door is 2 then nothing happens
door = input()
if door=='1':
choice = input()
if choice == 'run': print('you ran away')
if choice == 'die': print('you died')
elif door == '2':
print('you safely left the room')
0
first of all, you don't have to wrap numbers in their respective type functions. don't type int(2), just type the number.
about the question itself, what is the output or logic you want. the code nor the explanation doesn't help
0
Okay. I want like there is room. Then randoml choose what be in room like enemy or exit.
When if choose zombie with exit, when use input 2nd time like if u want try run write 1(first was choose door) if die write 2. Its okay with this but if choose exit without anything, that input (u want try run to exit or die) It appers to exit without anything. I want to not us input in second random choose
0
just remove the second input and use the last input's value
i = int(input())
if i==1:
print("hahaahha")
elif i == 2:
print("hahahhaahHHH")
0
okay i understand. But i need use in harder code. not like this. There choose door WITH input and need use again to run or die. when there is other situation. you saw exit and no need use input in there but input run or die and there show up.. Any fixes to not show input there?
0
Me figured out how to use it. Me use with def funcion so i can add code there, where i need :) thanks for answers