+ 1
interactive list, finish my noob code!
Trying to play with lists and i want to only enter a number to get one out of 6 alternatives. This is the code, maby you will understand where i want to get: alts = [ "alt1", "alt2", "alt3", "alt4", "alt5", "alt6", ] question = input("what alt? ") answer = input(question) def question(question): if answer == 1: print(alts[0]) elif input("2"): print(alts[1]) else: print("and so on") ------------------------------------ Of course its not full, but can someone write down a full code fo this?
4 odpowiedzi
+ 2
answer=int(input())
if(answer >=1 and answer <=6):
print(alts[answer-1])
+ 1
got it:
alts = [
"alt1", "alt2", "alt3",
"alt4", "alt5", "alt6",
]
answer = int(input())
if (answer >= 1 and answer <= 6):
print(alts[answer - 1])
wery much thanks!
0
ok im in over my head, back to the tutorials!:O
thanks anyway!!
0
writing in python 3 btw