Note: I don\'t need a program, I need a Design a python program for: a program t
ID: 3727020 • Letter: N
Question
Note: I don't need a program, I need a Design a python program for:
a program that reads in a string and prints whether it • contains only letters. • contains only uppercase letters. • contains only lowercase letters. • contains only digits. • contains only letters and digits. • starts with an uppercase letter. • ends with a period.
Example:
Example Design XMind: ZEN Trial Version Insert Header Information (Name, Program, Date, etd) Program Explanation - What does this do Import the random number generat Initialize/declare variables: response totaldice 0 Print/ask user if they want to pla import random die1 = random.randrange(6) +1 die2= random.randrange(6)+1 Calculations: totaldice = die1 + die2 print die1 print die2 print "You rolled... totaldice f totaldice-7 or 11-print 'Congratulations Press "Enter"to quit the gameExplanation / Answer
EXAMPLE DESIGN
|
|
|------------------------------------------------------------------------
| Calculate number of lower case character |
|------------------------------------------------------------------------
|
|------------------------------------------------------------------------
| Calculate number of Upper case character |
|------------------------------------------------------------------------
|
|
|------------------------------------------------------------------------
| Calculate number of digit |
|------------------------------------------------------------------------
|
|
|------------------------------------------------------------------------
| Calculate number of special character |
|------------------------------------------------------------------------
|
|------------------------------------------------------------------------
| Check first character is upper |
|------------------------------------------------------------------------
|
|------------------------------------------------------------------------
| Check last character is . |
|------------------------------------------------------------------------
|
|-------------------------------------------------------------------------------------------------
| Logic:
if
number of digit equal 0 and
number of lower case + number of upper + number of special character not equal 0:
Print ("Contains only letters");
else if
number of lower case + number of upper + number of special character ==0 and
number of digit not equal 0:
Print ("Contains only digits");
else if
number of upper not equal 0 and
number of lower equal 0 and
number of special equal 0 and
number of digit equal 0
Print ("contains only uppercase letters.");
else if
number of upper equal 0 and
number of lower not equal 0 and
number of special equal 0 and
number of digit equal 0
Print ("contains only lowercase letters.");
else if
number of upper equal 0 and
number of lower equal 0 and
number of special equal 0 and
number of digit equal not 0
Print ("contains only digits");
if(first character is upper)
Print ("Starts with an uppercase letter.");
if(last character is .)
Print ("ends with a period.");
|
|------------------------------------------------------------------------
| Ends |
-----------------------------------------------------------------------
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.