Popular Posts

Tuesday, August 18, 2020

Python Beginner: Mad Libs Game

 Hello, Developer! :)


Hope you're fine today for Python coding! 

Today, we will code "Mad Libs Game". This is a kind of word game to input requested words into the blank in the sentences. This game seems like the following screenshot from the Wikipedia(https://en.wikipedia.org/wiki/Mad_Libs)

I input below codes and showed executed result as following screenshot.

color = input("Enter a color: ")
plural_noun = input("Enter a Plural Noun: ")
celebrity = input("Enter a celebrity: ")

print("Roses are " + color)
print(plural_noun + " are blue")
print("I love " + celebrity)


Can you see the same result? Great! You can apply this format for a simple survey program.

See you next post, developer! :)

Python Beginner: Building a Basic Calculator

 Hello, Developer!

 How are you? Hope you're enjoying the Python coding! :)

So far, you have learned "print", "variables", "input" commands of Python.


Today, we will learn to build a basic calculator using these commands.

We will get two numbers from the user and add these numbers and show the adding result. 

Let's coding now! 

We used float() function for enabling decimal number adding. You can use it as the same way of int() function.


float(variable or number)

num1 = input("ENter a number: ")
num2 = input("Enter another number: ")
result = float(num1) + float(num2)

print(result)

The result showed as following

Can you see the same result? Good job!

If you have more time for exercise, let's make another simple calculator using +, -, *, / operators.

All good? See you next post! :)


Python - Web crawling exercises

Hello Python developer! How are you? Hope you've been good and had wonderful time with Python. There are 10 Python requests module exerc...