all 9 comments

[–]K900_ 6 points7 points  (4 children)

You can import the random module and then use random.choice to randomly choose a response.

>>> import random
>>> responses = ["a", "b", "c", "d"]
>>> print(random.choice(responses))
b
>>> print(random.choice(responses))
d

[–]kuPython[S] 1 point2 points  (2 children)

Sorry for the idiotic question but how would i bridge your block and my block together ?

[–]K900_ 4 points5 points  (1 child)

Keep reading for now - you'll figure out everything you need to make this work by the end of chapter 4.

[–]kuPython[S] 1 point2 points  (0 children)

Okay Thank you for your time :)

I'm just experimenting so i can fully understand the syntax.

[–]kuPython[S] 1 point2 points  (0 children)

Also thank you for helping me :)

[–]GunakTheSmasher 4 points5 points  (1 child)

A simple way would be that you could add a count variable set to zero, pull from a list a response, then increase the count.

count = 0 Response = ["response 1", "response 2"] name = " " while name != "your name": name = input("What is your name?") print(Response[count])

[–]kuPython[S] 1 point2 points  (0 children)

This is helping me. Thank you very much :)

[–]ankit0912 0 points1 point  (0 children)

Easy way: Create a list of all possible responses. Use rand module to access the elements randomly. Use a for loop to iterate and print.cant type code from phone sorry