Difference between revisions of "More to Python"

From CompSciWiki
Jump to: navigation, search
m
Line 4: Line 4:
 
|Introduction=More to Python
 
|Introduction=More to Python
 
|Body=
 
|Body=
 +
==String Method==
 +
Your task is to ...
 +
 +
First, we need three variables:
 +
#input - hold the user's input
 +
#vowelCount - keep track of vowels
 +
#done - control the while loop
 +
 +
Second, we need to get the user's input using raw_input(prompt)
 +
{{CodeBlock
 +
|Code=
 +
#get the user's input
 +
input = raw_input("Enter a sentence:")
 +
 
}}
 
}}
 +
}}
 +
 +
 +
Then we'll check the vowelCount
 +
{{CodeBlock
 +
|code=
 +
input = input.toLowerCase();
 +
}}
 +
 +
==Create an Array==

Revision as of 12:28, 3 April 2012

COMP 1010 Home > Back to Extra Labs

Introduction

More to Python

String Method

Your task is to ...

First, we need three variables:

  1. input - hold the user's input
  2. vowelCount - keep track of vowels
  3. done - control the while loop

Second, we need to get the user's input using raw_input(prompt)

 #get the user's input
input = raw_input("Enter a sentence:") 


Then we'll check the vowelCount Error: Unfilled Code parameter

Create an Array