id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

amgreyson@gmail.com > conditionalStatements
prev  |  next  |  chance

Given two strings p and q, assume the original statement is "If p, then q." Return the specified type of related statement ("converse", "inverse", or "contrapositive"). For example, if p is "a cat" and q is "a feline", then the original statement is "If a cat, then a feline." If relatedStatement is "contrapositive", then return "If not a feline, then not a cat."


conditionalStatements('a cat', 'a feline', 'contrapositive') → 'If not a feline, then not a cat.'
conditionalStatements('raining', 'wet', 'converse') → 'If wet, then raining.'
conditionalStatements('a snake', 'legless', 'inverse') → 'If not a snake, then not legless.'

...Save, Compile, Run (ctrl-enter)

def conditionalStatements(p, q, relatedStatement):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 175 Post-solution available

Copyright Nick Parlante 2017 - privacy