Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Number Series
#1
This was the given question :

Write a Python program that prints all the numbers from 0 to 6 except 3 and 6.
Note : Use 'continue' statement.
Expected Output : 0 1 2 4 5

This is my code :

for i in range(6):
    if i == 3:
        continue
    elif i == 6:
        continue
    else 
        print i 
and error output :

Error:
CaiGengYangs-MacBook-Pro-2:Lesson 1 caigengyang$ bash Question8.py Question8.py: line 5: syntax error near unexpected token `(' Question8.py: line 5: `for i in range(6):'
Please advise thanks
Reply


Messages In This Thread
Number Series - by MrGoat - Jan-17-2019, 05:53 AM
RE: Number Series - by stullis - Jan-17-2019, 06:26 AM
RE: Number Series - by perfringo - Jan-17-2019, 07:37 AM
RE: Number Series - by MrGoat - Jan-17-2019, 10:00 AM
RE: Number Series - by perfringo - Jan-17-2019, 10:22 AM
RE: Number Series - by MrGoat - Jan-17-2019, 01:38 PM
RE: Number Series - by perfringo - Jan-17-2019, 01:49 PM
RE: Number Series - by MrGoat - Jan-17-2019, 01:55 PM
RE: Number Series - by hbknjr - Jan-17-2019, 02:06 PM
RE: Number Series - by MrGoat - Jan-17-2019, 02:10 PM
RE: Number Series - by Axel_Erfurt - Jan-17-2019, 02:05 PM
RE: Number Series - by ichabod801 - Jan-17-2019, 02:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  find the sum of a series of values that equal a number ancorte 1 508 Oct-30-2023, 05:41 AM
Last Post: Gribouillis
  Convert quarterly time series to monthly time series donnertrud 1 5,191 May-22-2020, 10:16 AM
Last Post: pyzyx3qwerty

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020