control structures | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

control structures

I have a question on the code project of control structures chapter in python

17th Jul 2021, 3:44 PM
ndatinya justin
ndatinya justin - avatar
10 Answers
+ 3
#try this n=int(input()) for x in range(1,n): if x%2==0: continue if x%3==0 and x%5==0: print("SoloLearn") elif x%3==0: print("Solo") elif x%5==0: print("Learn") else: print(x)
17th Jul 2021, 5:18 PM
Simba
Simba - avatar
+ 1
don't ask to ask, just ask
17th Jul 2021, 3:47 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 1
ndatinya justin copy the code and paste here let's help you debug... And if you haven't started the code or written anything, that means you do not understand that course. ##Go back and review the course again
17th Jul 2021, 3:59 PM
Ejeh Joseph
Ejeh Joseph - avatar
+ 1
ndatinya justin your problems are; 1. Your identations are wrong from if...(hope you know what's identation) 2. You didn't put colon at the end of the elif's
17th Jul 2021, 4:53 PM
Ejeh Joseph
Ejeh Joseph - avatar
+ 1
it's also running ,thank you Simba
17th Jul 2021, 5:38 PM
ndatinya justin
ndatinya justin - avatar
0
I m sorry if i m not clear , i just cant answer the code project
17th Jul 2021, 3:52 PM
ndatinya justin
ndatinya justin - avatar
0
n=int(input()) for x in range (1,n): if x % 3==0 and x % 5 ==0: print("solo learn") elif x % 2 ==0 continue elif x % 3==0 print("solo") elif x % 5 ==0 print("learn")
17th Jul 2021, 4:41 PM
ndatinya justin
ndatinya justin - avatar
0
ndatinya justin this is the correct code n=int(input()) for x in range (1,n): if x % 3==0 and x % 5 ==0: print("solo learn") elif x % 2 ==0: continue elif x % 3==0: print("solo") elif x % 5 ==0: print("learn"
17th Jul 2021, 4:50 PM
Ejeh Joseph
Ejeh Joseph - avatar
0
Thank you Ejeh Joseph it's running
17th Jul 2021, 5:18 PM
ndatinya justin
ndatinya justin - avatar
0
I have another question on the code project of function and modules my code is celsius=int(input()) fahrenheit=int(input()) def conv(c): celcius=9/5+32 fahrenheit=conv(celcius) print(fahrenheit)
17th Jul 2021, 5:42 PM
ndatinya justin
ndatinya justin - avatar