<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Emmanuel Adetoro</title>
    <description>The latest articles on DEV Community by Emmanuel Adetoro (@ademto).</description>
    <link>https://dev.to/ademto</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1068370%2F9fa60073-2c3b-40d1-b3c3-9e363ab62d61.jpeg</url>
      <title>DEV Community: Emmanuel Adetoro</title>
      <link>https://dev.to/ademto</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ademto"/>
    <language>en</language>
    <item>
      <title>Counting Vowels in a String: A Simple Python Program Tutorial</title>
      <dc:creator>Emmanuel Adetoro</dc:creator>
      <pubDate>Sun, 23 Apr 2023 04:18:13 +0000</pubDate>
      <link>https://dev.to/ademto/counting-vowels-in-a-string-a-simple-python-program-tutorial-2ecb</link>
      <guid>https://dev.to/ademto/counting-vowels-in-a-string-a-simple-python-program-tutorial-2ecb</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This program counts the number of vowels in a given string. It is a simple yet useful program that can be used to analyze text data and extract information about the vowels in a sentence, word or paragraph.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;To follow this tutorial, you should have a basic understanding of Python programming and be familiar with string manipulation and control structures.&lt;/p&gt;

&lt;h2&gt;
  
  
  Steps
&lt;/h2&gt;

&lt;p&gt;First, we need to prompt the user to enter the string to be analyzed. We can use the &lt;code&gt;input()&lt;/code&gt; function to ask the user for a string input and store it in a variable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;string = input("Please enter a string to count the vowels: ")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, we need to initialize a count variable to keep track of the number of vowels in the string. We can use a for loop to iterate through each character in the string and check if it is a vowel.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vowels = "aeiouAEIOU"
count = 0
for char in string:
    if char in vowels:
        count += 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we define a string of vowels and initialize the count variable to zero. We then loop through each character in the input string and check if it is a vowel. If the character is a vowel, we increment the count variable by 1.&lt;/p&gt;

&lt;p&gt;Finally, we can print the number of vowels in the string to the console.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(f"There are {count} vowels in the string '{string}'.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we use string formatting to print a message to the console that displays the number of vowels in the input string.&lt;/p&gt;

&lt;h2&gt;
  
  
  Full code
&lt;/h2&gt;

&lt;p&gt;Here's the full code for the program:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;string = input("Please enter a string to count the vowels: ")
vowels = "aeiouAEIOU"
count = 0
for char in string:
    if char in vowels:
        count += 1
print(f"There are {count} vowels in the string '{string}'.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we learned how to create a program that takes a string as input and counts the number of vowels in it. We used a for loop to iterate through each character in the string and checked if it was a vowel. We then printed the count of vowels in the string to the console. This program can be a useful tool for analyzing text data and extracting information about vowels in sentences, words or paragraphs.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Name and Greet Project</title>
      <dc:creator>Emmanuel Adetoro</dc:creator>
      <pubDate>Fri, 21 Apr 2023 02:55:52 +0000</pubDate>
      <link>https://dev.to/ademto/name-and-greet-project-3ded</link>
      <guid>https://dev.to/ademto/name-and-greet-project-3ded</guid>
      <description>&lt;p&gt;Name and greet" is a simple Python project that allows the user to input their name and select a type of greeting. Based on their choice, the program outputs a personalized greeting. This project is a great way to get started with Python programming and practicing input/output functionality, if/else statements, and user prompts.&lt;/p&gt;

&lt;p&gt;The program can be customized and expanded by adding more greeting options or by making the program more interactive, such as asking the user additional questions or providing them with more choices. With a few modifications, this project can be turned into a more complex chatbot or an interactive user interface for greeting people.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Open your Python development environment (such as IDLE or PyCharm).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a new Python file and name it &lt;code&gt;main.py&lt;/code&gt;.&lt;br&gt;
Start by printing a welcome message to the user:&lt;br&gt;
python&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Welcome to the name and greet program!")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Next, prompt the user to enter their name:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name = input("Please enter your name: ")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Once the user enters their name, prompt them to select a type of greeting:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(f"Hi {name}! How would you like to be greeted?")
print("1. Say hello")
print("2. Wave")
print("3. Smile")
choice = input("Enter your choice (1/2/3): ")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now, based on the user's choice, output a personalized greeting:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if choice == "1":
    print(f"Hello {name}, wishing you a pleasant day from here")
elif choice == "2":
    print(f"Nice to meet you {name}! Waves")
elif choice == "3":
    print(f"It's so nice to meet you with a smile {name}. The Lord is your strength")
else:
    print("Invalid choice. Please enter 1, 2 or 3.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Finally, print a thank you message to the user:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Thanks for using the name and greet program!")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Save the file and run the program to test it out.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 main.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it! This simple program prompts the user to enter their name and then allows them to select a type of greeting. Based on their choice, a personalized greeting is displayed. You can customize the program with additional features or make it more interactive.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Follow me on twitter &lt;a href="https://twitter.com/agba_software"&gt;Emmanuel Adetoro&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Source code &lt;a href="https://github.com/ademto/50-days-of-python-projects"&gt;Download source code&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>50daysofpythonprojects</category>
      <category>100daysofcode</category>
      <category>python</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Day 1: Calculator App with Python</title>
      <dc:creator>Emmanuel Adetoro</dc:creator>
      <pubDate>Thu, 20 Apr 2023 08:56:41 +0000</pubDate>
      <link>https://dev.to/ademto/calculator-app-with-python-588b</link>
      <guid>https://dev.to/ademto/calculator-app-with-python-588b</guid>
      <description>&lt;p&gt;Python is a popular programming language that is widely used for various tasks such as data analysis, web development, and automation. One of the basic tasks that can be performed using Python is arithmetic calculations. In this tutorial, we will be creating a simple calculator program in Python that prompts the user for input, performs arithmetic calculations based on the user's input, and displays the result to the user. This tutorial is aimed at beginners who are new to Python and are looking to learn how to create basic programs in the language. We will be covering the essential Python programming concepts such as functions, user input, conditional statements, and printing output. By the end of this tutorial, you should have a good understanding of how to create a basic calculator program in Python.&lt;/p&gt;

&lt;h2&gt;
  
  
  Requirements
&lt;/h2&gt;

&lt;p&gt;Before getting started, you'll need to have Python installed on your machine. You can download and install Python from the official website: &lt;a href="https://www.python.org/downloads/"&gt;https://www.python.org/downloads/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Create and open a new Python file
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we are going to create two files, the first one is for getting input from user and the second is for defining the function. Open a new Python file in your preferred code editor. You can name the file whatever you like. In this example, we'll name the first file main.py and the second one calculator.py.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Define a function for each operation in the &lt;code&gt;calculator.py&lt;/code&gt; file
&lt;/h2&gt;

&lt;p&gt;We are going to define a function for each of the four arithmetic operations that the calculator will support: addition, subtraction, multiplication, and division in the &lt;code&gt;calculation.py&lt;/code&gt; file. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def add(num1, num2):
    return num1 + num2

def subtract(num1, num2):
    return num1 - num2

def multiply(num1, num2):
    return num1 * num2

def divide(num1, num2):
    return num1 / num2`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Getting input from the user
&lt;/h2&gt;

&lt;p&gt;In Python, we use the &lt;code&gt;input()&lt;/code&gt; function to get input from the user. Now we are going to use this function to prompt the user to enter two numbers they want to perform the calculation on, and store these numbers in variables. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;first_number = float(input("Please enter the first number: "))
second_number = float(input("Please enter the second number: "))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; that we convert the user input to a float, since we want to be able to handle decimal numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Get the operation choice from the user
&lt;/h2&gt;

&lt;p&gt;Use the &lt;strong&gt;&lt;code&gt;input()&lt;/code&gt;&lt;/strong&gt; function to prompt the user to select an operation. Store the user's choice in a variable. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("\nPlease select an operation: \n1. Add \n2. Subtract \n3. Multiply \n4. Divide")
choice = input("\nEnter your choice (1/2/3/4): ")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 5: Perform the calculation
&lt;/h2&gt;

&lt;p&gt;Use a conditional statement to determine which function to call based on the user's operation choice. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if choice == "1":
    result = add(first_number, second_number)
elif choice == "2":
    result = sub(first_number, second_number)
elif choice == "3":
    result = mul(first_number, second_number)
elif choice == "4":
    result = div(first_number, second_number)
else:
    print("Invalid choice")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 6: Display the result
&lt;/h2&gt;

&lt;p&gt;Use the &lt;strong&gt;&lt;code&gt;print()&lt;/code&gt;&lt;/strong&gt; function to display the result of the calculation to the user. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("The result is:", result)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 7: Run the program
&lt;/h2&gt;

&lt;p&gt;Save the file and run it from the command line using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 calculator.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see the program prompt you for input and display the result of the calculation based on your input.&lt;/p&gt;

&lt;p&gt;Congratulations, you have created a basic calculator program in Python that prompts the user for input and displays the result!&lt;/p&gt;

&lt;p&gt;Github repository &lt;a href="https://github.com/ademto/50-days-of-python-projects"&gt;50-days-of-python&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Follow me on twitter &lt;a href="https://twitter.com/agba_software"&gt;Emmanuel Adetoro&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>50daysofpythonprojects</category>
      <category>100daysofcode</category>
      <category>python</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
