-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query, Discussion & Bug Report #3
Comments
Solution Can be of question 14: print("UPPER CASE: ",upper) |
Added. Thank you :) |
In problem 17 How do I terminate this while true condition????? |
Just check whether the input is empty or not. |
In answer 14, your solution 2, what is '{0}' and '{1}'? I don't understand. |
In python, while printing a dynamic value inside a string, there are several ways to format the output string. For example, let's say you have two variables a = 10 and b = 20 and you want to output something like this,
You can do this by writing it in this way,
Here 0, 1, 2 inside '{ }' represents the order of a, b and a+b respectively. However, If the code is written in this way,
then the output will be like,
But printing in this way is not very much necessary. It can be also written in this way,
which will give the same output as wanted. I was new to python at that timeline so that I learned and used in {0}, {1} style which is actually not mandatory at all. Thank you :) |
Thank you for teaching me. |
#This could be the ans for 16 |
Added to question# 16 |
Question 38 ans proposition: tup = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) |
Added. Thank you. Sharing new questions and solutions are warmly welcome. Be a proud contributor of this repository by just making a pull request of your changes. |
For Q. 16 the answers are all wrong. You say square each odd number yet your demo answer just prints odd numbers The correct answer is:
|
Yes, I also noticed the mistake. It's now fixed. Thank you for the cooperation :) |
Hi! I don't completely understand how the solution for question 9 works. |
Hi Leonedott, As the question says, a program that accepts sequence of lines that means the output will come after all the sequence of lines are taken. That's why a list is created to save the processed inputs and then show them all together as output. The program will take input until there is an empty line. The program will take a line as input, then make it upper case and append in the list. If the program founds any empty string line, it will break and come out of the loop, and then show all the lines which are saved in the list. If you still have any queries, please feel free to ask. Thank you :) Sharing new questions and solutions are warmly welcome. Be a proud contributor of this repository by just making a pull request for your changes. |
Here's my solution to exercise 17 `lst = [] balance = 0 Thanks so much for these exercises @darkprinx !!! |
Thanks for sharing your solution. There was a little mistake. I corrected it and added it. |
Who is the main author plzz telll me sir,@darkprinx |
Problem with Question 70. |
I actually mentioned where I get these problems. It's all described here in the readme. I tend to mention the person as the main author coz the source I found first from his repository. |
It was a mistake in my code of python3. I mistakenly ignored 0 as a member of the list. I fixed it now. Thank you very much for the co-operation :-) |
Can you please give me more question from topics
…On Wed, 6 Nov 2019, 11:22 p.m. MarkisLandis ***@***.*** wrote:
Problem with Question 70.
It says random even integer from 0 to 10. 0 is even. But they left it out.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANMX5BMDAPR2DRK22XJVDJLQSL74VANCNFSM4GQP6TLA>
.
|
Answer for Question #30 |
Question #34 answer |
Both solutions are added. Thank you :) |
Question 97: |
Question 102: |
Question 103: |
Hi, I am a newbie, however, could not help and notice that in question 1 in the first python3 solution, there is this: |
Question 2 in while loop I am getting ValueError: |
Question 1: lst = list(filter(lambda i: i % 7 == 0 and i % 5 != 0, range(2000,3201))) |
Question 14: sentence = input("Enter a sentence: ") |
Hello. |
Indeed not normal. But it's OK. Don't let it stop you. You just found something new to learn. Keep on keeping on. |
Do not worry!!! Did you solve exercises on your own without looking at the solution? If not, you should!! You will fail once or twice but then you will get a gist of how to approach a problem!! It’s normal!! Don’t let it stop keep going!! |
It is normal that when you start coding, you can't immediately solve the questions. As long as you keep practising, you will get there. Dont give up. We have experiences what you have been through |
#Could this be another solution for q6? x = input() y = x.split(",") my_list = [] for number in y: for item in my_list: #i have directly put the values of C and H instead of using the variables. |
捉虫,最后的conclusion里单词写错嘞,是syntax句法,不是syntex |
捉虫,Question 7 note里的j,省略号不对,怎么成小i了 |
第一天的conclusion |
有地方写错了应该,Q49 hints:To override a method in super class, we can define a method with the same name in the super class.应该是To override a method in super class, we can define a method with the same name in the sub class.在子类中定义才对吧 |
q50 hints:UUse 多打了个U |
It can be solution of question 3. Five brackets in the end of line two, bruh. But it's two line solution : ) i = int(input('Number?\n')) |
One string solution for question16: |
To the person who programmed the website. Is there anyway to send the question when someone posts a solution? It makes it easier for us to have question and solution together instead or us hunting for it? Or at least a link?Thanks!MarkisSent from my iPhoneOn Sep 26, 2023, at 4:39 PM, rameshkamir ***@***.***> wrote:
One string solution for question16:
print(",".join([str(int(item)**2) for item in input().split(',') if int(item) % 2 == 0]))
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
it can be solution of question 1:
|
i made some changes of solution by @minnielahoti to question 2:
|
Hi Yuanhui, Let's take a look at Python's source code for the built-in print function. For print, as it is as built-in function, you can find this information executing The source code contains the following:
We find out that by default a space separates values in a string. Rewriting your code as follows removes the indent because the separator is assigned an empty:
|
I thought this was a neat solution to Question 96 that doesn't require textwrapper...
|
Hi, print function in Python adds a space between passed values. That's why
you have an extra space after the new line.
…On Sun, 31 Dec 2023, 06:54 YuanhuiAtGit, ***@***.***> wrote:
*Indentation Issue with print(lst, '\n', tpl) in Python*
Description:
I am a beginner of python. And I faced an unexpected indentation problem
when using the print function in Python. The issue is specifically observed
when using print(lst, '\n', tpl) compared to print(f"{lst}\n{tpl}"). The
latter works as expected, but the former introduces an indentation on the
second line.
image.png (view on web)
<https://github.com/darkprinx/break-the-ice-with-python/assets/154571770/963eec89-4b8a-4a0f-90fb-dd8b2482feaf>
here is my code:
def generate_list_and_tuple():
seq = input()
seq = seq.split(",")
lst = [elem.strip() for elem in seq]
tpl = tuple(lst)
print(f"{lst}\n{tpl}") #this one works correctly
print(lst,'\n',tpl) #this one causes an indentation on the second line
I would like to understand why this indentation occurs and how to prevent
it while using the print function with multiple arguments.
Any insights into the root cause and a resolution would be greatly
appreciated.
—
Reply to this email directly, view it on GitHub
<#3 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQC3OGWFMW66P6RZC4QQUATYMDVXJAVCNFSM4GQP6TLKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBXGI3DOMBXGYYA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
That's helpful!! Thank you!!! |
Got it, thank you!! |
My own solution suggestion for question 21:
|
My own solution suggestion for question 88:
|
Hello Guys
If anyone wants to -
Please feel free to write it down and discuss here.
Sharing new questions and solutions are warmly welcome. Be a proud contributor of this repository by just making a pull request of your changes.
The text was updated successfully, but these errors were encountered: