Introduction: Counting Vowels Using Python
Python is a high-level computer program. In this instructable, there will be steps on how to count vowels using variables using Python language and programming. The demonstration is a question taken from the MITx: 6.00.1x Introduction to Computer Science and Programming Using Python class available on edx.org. If you are interested in this tutorial, it is recommended that you follow along with the class.
Step 1: Sign Up for the EdX Class
Even though this step isn't crucial, the program gives lots of background information on how to use Python and gives the exact problem set. MITx: 6.00.1x Introduction to Computer Science and Programming Using Python is the name of the free course on edx.org. It also has the variables already defined within the program. This question is under Week 1, Problem Set 1, Problem 1.
Step 2: Inputting Your Code Into Python Program
If your computer is able to run Python, then you should have no problem inputting your code into the program. However, if your computer is unable to run the Python program you may need to find an alternative program or website to run your code. Some alternative websites that read Python are SourceLair and Complir. Once your code is figured out, simply input your code into the Python program or alternative. An example code is shown in the image above.
Step 3: Pasting Your Code
There is a box where you can paste your code below the problem. The question asks you to write a program where that counts the number of values in the string "s" where the valid vowels are a, e, i, o, and u. The example problem given asks you to find a code for s = 'azcbobobegghakl'. Make sure your input does not include "raw_input" statements or defining the variable of s in any way. S is already defined in the MIT program so it is not necessary to define it.
Step 4: Checking Your Answer
After you have entered your code into the box, there is an option to check your answer underneath the box you had pasted your code into. The program should have printed 5 since there are 5 vowels in the code s = 'azcbobobegghakl' (two of a, one of e, three of o). However, this is not the correct output. The correct output is pictured and should be the output you had received. If you did not receive this output and you are doing this at the pace suggested, the grader will show what you had done incorrectly.