forked from skulpt/skulpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make startswith and endswith work - Issue skulpt#35
This is Issue 119 in Google Code
- Loading branch information
Showing
5 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
x = "Please make startswith and endswith work" | ||
if x.startswith("Please") : | ||
print "Starts with Please" | ||
else: | ||
print "Not good" | ||
|
||
if x.endswith("work") : | ||
print "Ends with work" | ||
else: | ||
print "Not good" | ||
|
||
if x.startswith("please") : | ||
print "Not good" | ||
else: | ||
print "Does not start with please" | ||
|
||
if x.endswith("please") : | ||
print "Not good" | ||
else: | ||
print "Does not end with please" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Starts with Please | ||
Ends with work | ||
Does not start with please | ||
Does not end with please |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Sym_type: module | ||
Sym_name: top | ||
Sym_lineno: 0 | ||
Sym_nested: False | ||
Sym_haschildren: False | ||
-- Identifiers -- | ||
name: x | ||
is_referenced: True | ||
is_imported: False | ||
is_parameter: False | ||
is_global: False | ||
is_declared_global: False | ||
is_local: True | ||
is_free: False | ||
is_assigned: True | ||
is_namespace: False | ||
namespaces: [ | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
Module(body=[Assign(targets=[Name(id='x', | ||
ctx=Store())], | ||
value=Str(s='Please make startswith and endswith work')), | ||
If(test=Call(func=Attribute(value=Name(id='x', | ||
ctx=Load()), | ||
attr='startswith', | ||
ctx=Load()), | ||
args=[Str(s='Please')], | ||
keywords=[], | ||
starargs=None, | ||
kwargs=None), | ||
body=[Print(dest=None, | ||
values=[Str(s='Starts with Please')], | ||
nl=True)], | ||
orelse=[Print(dest=None, | ||
values=[Str(s='Not good')], | ||
nl=True)]), | ||
If(test=Call(func=Attribute(value=Name(id='x', | ||
ctx=Load()), | ||
attr='endswith', | ||
ctx=Load()), | ||
args=[Str(s='work')], | ||
keywords=[], | ||
starargs=None, | ||
kwargs=None), | ||
body=[Print(dest=None, | ||
values=[Str(s='Ends with work')], | ||
nl=True)], | ||
orelse=[Print(dest=None, | ||
values=[Str(s='Not good')], | ||
nl=True)]), | ||
If(test=Call(func=Attribute(value=Name(id='x', | ||
ctx=Load()), | ||
attr='startswith', | ||
ctx=Load()), | ||
args=[Str(s='please')], | ||
keywords=[], | ||
starargs=None, | ||
kwargs=None), | ||
body=[Print(dest=None, | ||
values=[Str(s='Not good')], | ||
nl=True)], | ||
orelse=[Print(dest=None, | ||
values=[Str(s='Does not start with please')], | ||
nl=True)]), | ||
If(test=Call(func=Attribute(value=Name(id='x', | ||
ctx=Load()), | ||
attr='endswith', | ||
ctx=Load()), | ||
args=[Str(s='please')], | ||
keywords=[], | ||
starargs=None, | ||
kwargs=None), | ||
body=[Print(dest=None, | ||
values=[Str(s='Not good')], | ||
nl=True)], | ||
orelse=[Print(dest=None, | ||
values=[Str(s='Does not end with please')], | ||
nl=True)])]) |