Showing posts with label not. Show all posts
Showing posts with label not. Show all posts

Monday, January 12, 2015

Creating a New String With For Loop

The program below demonstrates the creation of a new string using a For Loop. The program below simply creates a new string from a user inputted string with the vowels removed. See below:


Thursday, January 1, 2015

Using the not Logical Operator and Compound Conditions

In the program below, username is initialized as an empty string so it starts out as False, making not username True. The not username is True as long the string is empty. This forces the username to enter a username, or the loop will continue to ask for username until something is entered. Once an input is entered for username the not username is False and the loop stops, moving the program forward to password, which is set up in a similar manner. The table below summarizes the logic:

Username
not username
True
False
False
True

The program also demonstrates the use of and / or compound conditions. See examples below.