Skip to main content

An Alcoholic Python Program! My friends' first step in Python programming XD

Hi folks,
             Today my dear friends Akshay and Chetan have taken their first step towards learning the Python programming language. This is the program they have written after learning the language for the whole day.

             Let us appreciate their interest towards learning Python.
            
             They sure have a fun way of learning things. I hope you like the program!

Thank you!         :)

#Basic input operation
day = raw_input("What is the day today??\n")

#list declarations
weekday = ['monday','tuesday','wednesday','thursday','friday']
weekend = [
'saturday','sunday']

#Implementation of if statements
if day in weekday:
   
print 'You cannot drink'
   
exit(0)
elif day in weekend:
   
print 'You can drink today!!!!!!'
   
print 'These are the drinks available'
   
beer = ['kingfisher','miller','budweiser']
    whiskey = [
'royal stag','ib','antiquity']
    rum = [
'old monk','kodais']
   
print "BEER"
  
#Implementing for loops
   
for p in beer:
       
print(p)
   
print "WHISKEY"
   
for q in whiskey:
       
print(q)
   
print "RUM"
   
for r in rum:
       
print(r)

drink =
raw_input("Which drink would you like??\n")

if drink in beer:
    
print 'Get 200rs'
if drink in whiskey:
    
print 'Get 100rs'
if drink in rum:
    
print 'Get 80rs'

wine_gate = [beer[0],beer[1],whiskey[0],rum[0]]
london_street = [beer[
2],whiskey[1],whiskey[2],rum[1]]

hotel = [
"winegate","londonstreet"]

print "Please choose one of the available hotels:\n"
print hotel
hotel2 =
raw_input("which hotel?\n")
drink2 =
raw_input("which drink?\n")
if hotel2 in hotel and drink2 in wine_gate:
   
print "success! You got drunk"
else:
   
print "Drinks not available"


Comments

Popular posts from this blog

Intro to Python Programming - 2. Basic Output

Hello everyone!           Considering the lot of requests I received from my dear friends and viewers, I shall now start posting step by step tutorials for mastering Python programming. I proceed with the assumption that you have a basic foundation of the C programming language . If not much of it, at least having some idea about the type specifiers such as ‘%d for integer, %f for floating point variables etc.’ and also, some basic ideas about data types such as int , float , char etc. would be of great help. :)           Before we begin with the coding part of python, I want you to understand a few basic concepts, like: 1.      Python is scripting language. 2.      Python programs do not make use of statement terminators like semicolons ‘;’ as in C, C++ and Java. 3.      A basic Python program does not require any header ...

Kotlin :A New Beginning

Hello guys, You might have heard about a new language supported for the android Officially by Google,Named as Kotlin. Kotlin is a statically typed Programming language.By statically typed language i mean that the type checking is done during complile time. It was developed in July 2011 by Jetbrains in Russia,In 2017 Google declared Kotlin as the official langauge for android. However the Traditional Java developers are sticking to java. New programmers who want to make android apps,Web apps can use Kotlin as a language of preference. With this Post i welcome you to the world of Kotlin. There is no good book for kotlin but there is the official documentation on Kotlin.I refer the official Kotlin documentation. The main aim of this post if to Introduce you Kotlin and its Uses and also how to write programs in Kotlin. The official documentation can be found on the website   KOTLIN I belive that this post will help you to write codes in Kotlin. So lets begin Fir...

Assembly code generator for non parenthesized arithmetic expressions using Python Programming Language.

Hi guys, I hope you like the code I'm posting. This program is written in Python Programming language and it converts the non parenthesized arithmetic expressions to Assembly level code. Try a = b + c / d to test the code. And this should be the expected output: The Genereated code is: LD R0 ,c LD R1 ,d DIV R0 ,R0 ,R1 LD R1 ,b LD R2 ,temp ADD R1 ,R1 ,R2 ST temp , R1 Please Note: Do include a space (" ") between the operators and operands. And keep it in your mind that this is a code generator. Hence please do try it with valid expressions only. Upgrading the code for implementing the 'if' and looping constructs like 'while' and 'for' and sharing the modified code with us and other coding enthusiasts is really very well appreciated. I shall make another post about the explanation of the code soon. Until then, please do comment on our post and share our link to other coding lovers like yourself! I ho...