Skip to main content

Weekend Project - Weekend Emotion

Welcome to another awesome weekend and starting today every weekend we are going to do some fun projects and today we are going to do something related to weekend. First of all create an empty python file with the name , it is very important to keep the extension of the file as py which will tell the interpreter that this is a python scrpt file. Save the file in the path of you choice (for my machine the path is ~/PycharmProjects/untitled). Paste/type the following code into this file -
def weekn(day):
  say_like = ""
  if day == "Saturday":
      say_like = "HURRAY it's weeknd :D:D"
  elif day == "Weekday":
      say_like = ":( :("
  elif day == "Friday":
      say_like = "Yeeeee :D :D"

today = "Saturday"
Save the file and then open the command prompt and type python3 and if you are in linux or if you are in windows and voila you will get the desired message depending on the day you have passed in the variable today.

What the code does?
We created a function weekn which takes in a parameter day. The code checks what day it is, if it’s saturday then it prints the appropriate message and if it’s some other day then it prints the required message. In the variable today we pass the day we want and the function returns the required message to us.

What else now?
Now that you have run the above code and successfully generated the message why not make the code more dynamic? Why not improve it to make it more shorter? So go ahead play around the code an you can post your version in the comment section below.

Subscribe to my youtube channel to watch new python programming tips and tutorials..

If you wanna get started in learning Python then why not get started with the python basics chapter. Check out this link to access the Python Basic Chapter for free.

If you want to download a copy of the chapter then purchase the chapter by clicking on the following link.

Additionally you can also bug me on Quora. You can also find me on Twitter or Facebook. So, why wait go ahead and start exploring.


Popular posts from this blog

How To Install Tensorflow On Windows

Why I am writing this tutorial ?
Recently I have started learning machine learning specifically DeepLearning for one of my pet projects, and during this quest of mine I wanted to learn TensorFlow library which is developed by Google. Learning is one thing but first I needed to install the library, but there was this problem which I faced during the installation. I am using Anaconda as my package manager and trying to install the Tensorflow library on my work computer which is behind a proxy, installing directly from the anaconda cloud while behind a proxy always displayed a proxy error.

How did I resolve the issue? Well this is exactly what I am going to write down in the below tutorial. The Steps To Follow
Before we get all cosy with this short tutorial on Tensorflow installation, let me tell you that
this tutorial is on the assumption that you have already installed Anaconda on your machine and you know at least a few basic things or two about python.
If you want to learn basic pyt…

What I learned from writing a guest post

Recently I wrote a python tutorial for Datacamp, while writing this tutorial I learned a couple of things which I am going to share with you right here in my blog post. May be you can use my experiences in your own endeavours as a writer.
IdeaThe first step is idea generation. You can either search through any previous topics in your blog post if you have one or you can go through your past learning, experiences or any problem statement that you might have gone through and you will find that while doing that you can get tons of ideas to start your article. If you fall short of ideas then you can ask for help from may be your social media followings your friends or your family, for example I asked the people at Datacamp themselves and they suggested me a couple of topics which got me started on the right note. So, be prompt to ask for help and you will be surprised how easily you can crowd-source ideas and there's nothing wrong in it.

Squeezing in time

Squeezing in time to get into …
Encountering The Python
What is Python? As per Wikipedia “Python is a widely used high-level, general-purpose, interpreted, dynamic programming language.” Python is an open source programming language which was conceived in the late 1980s and its implementation began in December 1989 by Guido van Rossum (more on it here).
What kind of programing language?To give a better idea let's look at the below mentioned summary-
High level language- Python is a high-level language because it provides strong “abstraction”.Interpreted - Python is an Interpreted language because it does not run on a compiler.Dynamically typed language - Python is dynamically typed because in python every variable is bound to an object.Why should I learn Python?Python is a very powerful programming language, secondly it's easier to learn and since it's interpreted language the code is easier to understand. Lastly there is a huge community supporting Python so if you get stuck anywhere lot's of help are a…