Your choice?

Let us look at some image. Now a days image uploading has become very difficult. Why?


You feel this happens to you very often in real life. You have to make blind choices. And no matter what you do it will prove to be harmful to you. Happens to me.

No, no, this funny (dark) game is completely text based and written in python with just 42 lines of code.

Not my invention. I copied it from http://inventwithpython.com

If you are interested, here is the program.


import random
import time
 
def displayIntro():
   print('''You are in a land full of dragons. In front of you,
   you see two caves. In one cave, the dragon is friendly
   and will share his treasure with you. The other dragon
   is greedy and hungry, and will eat you on sight.''')
   print()
 
def chooseCave():
      cave = ''
      while cave != '1' and cave != '2':
          print('Which cave will you go into? (1 or 2)')
          cave = input()
 
      return cave
 
def checkCave(chosenCave):
     print('You approach the cave...')
     time.sleep(2)
     print('It is dark and spooky...')
     time.sleep(2)
     print('A large dragon jumps out in front of you! He opens his jaws and...')
     print()
     time.sleep(2)
 
     friendlyCave = random.randint(1, 2)
 
     if chosenCave == str(friendlyCave):
         print('Gives you his treasure!')
     else:
          print('Gobbles you down in one bite!')
 
playAgain = 'yes'
while playAgain == 'yes' or playAgain == 'y':
      displayIntro()
      caveNumber = chooseCave()
      checkCave(caveNumber)
 
      print('Do you want to play again? (yes or no)')
      playAgain = input()
Python is quite a popular language nowadays. But first of all it is a scripting language and is interpreted.

And the syntax is really bugging to people who go from programming background. You should not write conditional expressions in brackets.

And most irritating is indent for blocks!! Most of the time you will try correct error which says "unexpected indent"

Anyways people say it is powerful. It must be. Because pinterest is written in it.

I had installed sololearn's python course in my phone. And I completed coursera's introductory course in this language. Still not feeling inclined towards it.

Comments

Popular posts from this blog

ಹೂಗಳು

ಎಮ್ಮೆ

Not for nation