+ 2

why wont this work?? how do i use continue

total = 0 #your code goes here human = int(input()) if human < 3: total += 0 if human >= 3: continue total += 1 print(total) i dont know how to put continue in a loop!

26th Dec 2022, 12:47 AM
Travisthenics
Travisthenics - avatar
12 Respuestas
+ 9
https://code.sololearn.com/cYc9kCs4Yr17/?ref=app Travisthenics , Continue statement is used to stop the current iteration and it will continue the next iteration...I did little modification to your code In the code if you input less than 3 The output will be 0 And if you input 3 and more than 3 The loop runs and you can see it will miss 2 in the output since I use continue if total ==2 Hope you understand..
26th Dec 2022, 1:14 AM
Riya
Riya - avatar
+ 7
Travisthenics , this code gets only one input but the question takes n inputs So ages must be taken using for loop
26th Dec 2022, 4:59 AM
Riya
Riya - avatar
+ 6
Travisthenics , What is the task? Can you elaborate the question ?
26th Dec 2022, 4:49 AM
Riya
Riya - avatar
26th Dec 2022, 5:22 AM
Riya
Riya - avatar
+ 1
@riya thanks yes i do understand what you said but how can i make the numbers not go up to 100s and 100s
26th Dec 2022, 4:42 AM
Travisthenics
Travisthenics - avatar
+ 1
Riya i am trying to stop your code from printing heaps of numbers i am trying to complete the activity called Ticket prices in python introduction
26th Dec 2022, 4:54 AM
Travisthenics
Travisthenics - avatar
+ 1
Travisthenics just use the for loop
27th Dec 2022, 7:29 AM
Alex Wairegi
Alex Wairegi - avatar
0
Analyze Height Data Lasaad Awewi heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191] Here are a few ideas for what you could do with this list of heights: Calculate some summary statistics: You could find the mean, median, mode, standard deviation, and other measures of central tendency and dispersion to get a sense of what the typical height is and how much heights vary in this group. Visualize the data: You could create a histogram or box plot to visualize the distribution of heights in this group. This can help you see patterns and identify outliers more easily. Analy Compare to a reference group: If you have data on the heights of a reference group, such as the general population, you could compare the two groups and see if there are any significant differences between them. These are just a few ideas, and there are
26th Dec 2022, 5:17 PM
Lasaad Aouaoui
Lasaad Aouaoui - avatar
0
𝐃𝐑𝐈𝐒𝐇𝐓𝐈 indentation honestly
27th Dec 2022, 7:28 AM
Alex Wairegi
Alex Wairegi - avatar
0
Yhgyh
28th Dec 2022, 12:25 AM
Mr: Morshed
- 1
maybe try correcting the indentation
26th Dec 2022, 11:15 AM
icerd
icerd - avatar