+ 1

Lesson 30 ranges

I have just learnt about ranges in lesson 30, and can do them correctly if using fixed data. I can get the sample input and output to work and give me the desired outcome, but the lesson didn’t cover how to code ranges using user input, and this is where I am stuck. I googled for an answer, but the methods I found didn’t work. Any guidance to help me would be greatly appreciated.

15th Jan 2022, 4:01 AM
Gina
15 Réponses
+ 1
Thank you for responding to my question. I’m sorry, I am new on here, i started on Monday, so I am just learning how to do anything, whether programming or interacting with others. I didn’t realise that i needed to post code in query, and i deleted what i had done to start fresh, it was a mess, lol. I have no doubt i will end up where i started again, so i will post code then. Thank you for your guidance, i’ll be back when i have code again.
15th Jan 2022, 4:52 AM
Gina
+ 10
No worries Gina , take your time for learning. If you make any code or projects use Sololearn playground. For open ended discussion you can always create posts in your activity feed. It is always helpful to share your code or attempt you have done so far. So, that we can help you from the step you got stuck. Check out the links belows: One is community forum and guidelines link: https://www.sololearn.com/Discuss/1316935/?ref=app Another is helpful for getting helpful answers based on how informative your code/question is: https://www.sololearn.com/Discuss/333866/?ref=app
15th Jan 2022, 5:16 AM
Shivani 📚✍
Shivani 📚✍ - avatar
+ 9
Please share your attempt so that community members can help.
15th Jan 2022, 4:11 AM
Shivani 📚✍
Shivani 📚✍ - avatar
+ 5
You're most welcome Gina ! :) A little help for you on how to mention someone in q&a discussions for those you help or others are helping you. Use "@" before whomsoever name. This way they will get informed your response, just in case if they are not following thread after helping. Happy learning! 🌷🌸 Edit: Have a great week ahead Gina & stay safe!
18th Jan 2022, 2:06 AM
Shivani 📚✍
Shivani 📚✍ - avatar
+ 4
In this challenge, you don't need to change two arguments(2005,2011) to an input variable. You just have to replace them as two input variables. x = int(input()) y = int(input()) l = list(range(x,y)) ...
15th Jan 2022, 6:05 AM
Simba
Simba - avatar
+ 3
Gina I believe you mean something like r = int(input()) for i in range(r): or while r > 0: If this isn't what you meant please clarify ..
15th Jan 2022, 5:19 AM
BroFar
BroFar - avatar
+ 3
Thank you everyone, your help and guidance has been invaluable. Simba, your solution, fixed my problem and showed me where i am lacking in understanding, i went down that path, but i couldnt work out how to combine the two, i kept getting Syntax error. I need to go back and study more on loops and ranges. Again, thank you everyone.
15th Jan 2022, 6:31 AM
Gina
+ 3
BroFar thankyou for the resources, they are perfect for what I need.
15th Jan 2022, 7:16 AM
Gina
+ 2
I known that X = list(range(2005, 2011) Print(x) I know that works when i run the test, but i need to convert “2005” and “2011” into input(), and that is what i am stuck on, converting the fixed data into user input. Everything i try comes back with a syntax error. I am giving it another crack at it soon (looking after my grand children at the moment) but meanwhile if you can point me in the right direction so i know what to study on, that would be appreciated.
15th Jan 2022, 5:31 AM
Gina
+ 2
BroFar yes, which will probably save me endless confusion in the future. Me: “I write to people and they don’t write back” 😥 You guys: “Why doesn’t she ever reach out for help?” 🤔 So, by adding one extra keystroke saves all that drama 😂 Have an amazing week.
18th Jan 2022, 2:40 AM
Gina
+ 1
Thank you Shivani, these links are very helpful, I will gain such a better understanding of how to go about things on here, making life so much easier. Everyone on here is so amazing, such a talent pool of knowledge, shared so generously, absolutely wonderful.
17th Jan 2022, 3:18 AM
Gina
+ 1
Shivani 📚✍ You are so awesome, I had wondered about whether I had to use an addy “@“ or not, makes perfect sense, lol. Have an amazing week.
18th Jan 2022, 2:19 AM
Gina
+ 1
Gina you are welcome and it looks like Shivani 📚✍ has taught you how to use the @ mention 👍
18th Jan 2022, 2:30 AM
BroFar
BroFar - avatar