Global searching is not enabled.
Skip to main content

Blog entry by bhumika dhingra

Truth n Dare Game with Coding in Python

*All important links are attached in the end.

Creating your own TRUTH AND DARE GAME on Funoppia’s FunAI Platform

Steps to Follow:

1. Visit Funoppia’s FunAI IDE from the Funoppia website & then Create a list of Truths by following the steps on the Platform.

a. Open List category present inside Data Structures category and get the first block out.





b. Open text category & get the first block out. Then attach it with list block.




c. Create a variable with name truths and attach its first block — set truths to — with the list block.




d. Now write some truth questions in the text boxes that you added.




2. Similarly, create a list of dares as well.




3. Now ask for the user’s choice.
a. Open the Input/Output category & get the Take Input Text block out.




b. Now, create a new variable with name choice & attach the set choice to block with the take input block.




4. Drag out the if-do block from the Logic category and the 2nd block also from the same category. Connect them as shown.




5. In the first blank, attach the variable with name choice and in the 2nd blank, attach the text block with truth written inside it as shown.




6. Now get the print block out from the input output category & attach it with the — in list list get #— block present in the list category.




7. First, Put this print block inside the do part of the if block. Now, click on list & a dropdown will appear. From that dropdown choose truths
list. After that click on the # in the same block & choose random option from the dropdown.





8. Now, click on the settings button present in the if-do block. Drag the else-if block and attach it under the if block inside the popup only (as shown)




9. Click on the settings button again, to close the popup & then complete your code as shown.




10. The last step! To check if any other wrong choice is entered by the user, again open the settings popup of if block & now drag the else block towards the right side & attach it
under the else-if block. Then add a print statement inside the do part of the else statement.






And you are done!!!! Press the Run Button

& try playing the game!


Important Links

• Funoppia Website — www.funoppia.com
• Funoppia IDE —www.funoppia.com/funide
• Blind Bird Game — funzone.funoppia.com/bird.html
• Funzone Games — funzone.funoppia.com
• Projects Playground — projects.funoppia.com
• Truth n Dare Game — projects.funoppia.com/truthanddare/
• Truth n Dare Game Code — https://www.funoppia.com/funide/#ikchzhg






Final Python code generated in the editor window:


 
import random


truths = ["What's your favorite fruit?", 'Who is your best friend?', 'What is your nickname?', 'Now, Can you create your own truth n dare game?']
dares = ['Drink a glass of water', 'Keep quiet for 5 mins', 'Create your own truth n dare game!']
choice = str(input())

if choice == 'truth':
print(random.choice(truths))
elif choice == 'dare':
print(random.choice(dares))
else:
print('Wrong choice!')

  • Share

Reviews

Comments