- 5
Print 'fb' from string "fooboo"
Without using inbuilt functions,indexing,slicing
21 odpowiedzi
+ 5
Impossible ! print is inbuilt too
+ 6
Another idea
word="fooboo"
a,b,c,d,e,f = word
print(a,d,sep="")
+ 1
Please show your code attempt!. Hint: use a for-loop
+ 1
Delete all o
+ 1
Revise the lessons on strings and control flow in Python Core course
+ 1
Oma Falk replace is inbuilt function
+ 1
Oma Falk read my question carefully
+ 1
Oma Falk thank you
+ 1
Shubham Gupta, my approach is worth reconsidering. It does not use indexing or slicing, and the sys module is imported from an external library. The sys.stdout.write() function is not inbuilt to the language like print(). Is there another, unpublished requirement?
0
just use indexes.
0
Oma Falk but how
0
Replace with ""
0
Thank u all for solution
0
If you may not use an inbuilt function then you must use an imported function to print.
import sys
.
.
sys.stdout.write(...)
Fill in the dots with the rest of the code by using a for/in loop and an if statement.
0
Can I do like this also
https://code.sololearn.com/cEz4hi3Km0x3/?ref=app
0
Shubham Gupta I think your fooboo(1) code is disqualified because it uses array indexing and the built-in print() function.
0
Brian then show me your code sir
0
Okay, Shubham Gupta, I will reveal my idea. Let me know if this meets the requirements:
import sys
for c in "fooboo":
if c!='o':
sys.stdout.write(c)
0
Brian No it not meets requirement you used built in module you have work more on it