0

Please help me revise the code. The purpose is to remove all vowels from text but the loop just do once then stop. Plz show erro

https://code.sololearn.com/c7A4iGgxC1ov/?ref=app

9th Jul 2018, 9:35 AM
Min Puc
Min Puc - avatar
11 odpowiedzi
+ 1
Your return statement is in the for loop put it in the function indentation instead
9th Jul 2018, 9:38 AM
TurtleShell
TurtleShell - avatar
+ 1
In Python 2 print is a statement instead of a function e.g. print 4 Also the Python 3 range is xrange in Python 2 (this is optional but is better performance wise)
9th Jul 2018, 9:49 AM
TurtleShell
TurtleShell - avatar
+ 1
Yes Python 2 and 3 ranges work differently. In Python 2 range returns a list, xrange and Python 3 range return something called a generator object which is much faster with big ranges (e.g. 1 -> 100000), they return a number every iteration rather than return a whole list at the start
9th Jul 2018, 10:11 AM
TurtleShell
TurtleShell - avatar
+ 1
https://docs.python.org/3/reference/simple_stmts.html#the-pass-statement
9th Jul 2018, 3:26 PM
Markus Kaleton
Markus Kaleton - avatar
0
Many thanks TurtleShell . By the way, could you show me why the revised code working in python 3 but not python 2?
9th Jul 2018, 9:43 AM
Min Puc
Min Puc - avatar
0
Thanks TurtleShell! But I don't understand 'xrange'. Does it imply that range in py3 different from py2?
9th Jul 2018, 9:54 AM
Min Puc
Min Puc - avatar
0
Thanks TurtleShell for your very promptly and clearly support!
9th Jul 2018, 10:57 AM
Min Puc
Min Puc - avatar
0
https://code.sololearn.com/c22ByGvQRLg9/?ref=app no need to use ranges or complicated statements
9th Jul 2018, 2:14 PM
Markus Kaleton
Markus Kaleton - avatar
0
thanks Markus Kaleton ! my code seems diffuse coz I'm not familiar with 'pass'. Could you help me understand it?
9th Jul 2018, 3:24 PM
Min Puc
Min Puc - avatar
0
many thanks Markus Kaleton ! I got it!
9th Jul 2018, 3:35 PM
Min Puc
Min Puc - avatar