Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: What To Build ?
Post: What To Build ?
So I am learning Python and finished the Python module on Codeacademy ...
I would like to build some interesting project that has real-world applications. Any good ideas for a beginner? |
|
MrGoat |
News and Discussions |
1 |
1,597 |
Jan-22-2020, 01:21 PM |
|
|
Thread: Number within range
Post: RE: Number within range
(Jan-21-2019, 09:40 AM)buran Wrote: you need to convert all your inputs to numbers using int(). Otherwise you are comparing strings, not numbers
I converted all inputs to numbers but got an invalid ... |
|
MrGoat |
General Coding Help |
4 |
3,237 |
Jan-21-2019, 10:12 AM |
|
|
Thread: Number within range
Post: Number within range
So, this was the question description I was given :
# 6.Write a Python function to check whether a number is in a given range.
Below is my code :
print("Enter number: ")
number = input()
print("En... |
|
MrGoat |
General Coding Help |
4 |
3,237 |
Jan-21-2019, 09:15 AM |
|
|
Thread: Sum of Numbers in a List
Post: RE: Sum of Numbers in a List
(Jan-20-2019, 02:29 PM)perfringo Wrote: If you want to practice even more then you could enter wonderful world of recursion.
One way of sum list elements:
>>> def sum_of_list_elements(ls... |
|
MrGoat |
General Coding Help |
8 |
4,388 |
Jan-20-2019, 02:37 PM |
|
|
Thread: Sum of Numbers in a List
Post: RE: Sum of Numbers in a List
(Jan-20-2019, 01:19 PM)Larz60+ Wrote: are you required to write the sum function? there is a bulit-in one
>>> xx = [1,2,3,4,5,6]
>>> sum(xx)
21
I wanted to do it without using the ... |
|
MrGoat |
General Coding Help |
8 |
4,388 |
Jan-20-2019, 01:40 PM |
|
|
Thread: Sum of Numbers in a List
Post: Sum of Numbers in a List
So this was the question description :
# Write a Python function to sum all the numbers in a list.
# Sample List : (8, 2, 3, 0, 7)
# Expected Output : 20
This is my code :
lst = []
i = 0
sum = 0
... |
|
MrGoat |
General Coding Help |
8 |
4,388 |
Jan-20-2019, 01:12 PM |
|
|
Thread: Max of 3 numbers
Post: Max of 3 numbers
Hi, so I am supposed to write a function to find the maximum of 3 numbers. Initially I wanted to write a function that takes in 3 values and analyzes each case by case , like this :
def Max ( x, y, z... |
|
MrGoat |
General Coding Help |
2 |
1,992 |
Jan-20-2019, 12:09 PM |
|
|
Thread: Number Series
Post: RE: Number Series
(Jan-17-2019, 02:06 PM)hbknjr Wrote: (Jan-17-2019, 01:55 PM)MrGoat Wrote: Still doesnt work whether I use shebang or not
(Jan-17-2019, 05:53 AM)MrGoat Wrote: Error:CaiGengYangs-MacBook-Pro-2:Les... |
|
MrGoat |
General Coding Help |
11 |
5,500 |
Jan-17-2019, 02:10 PM |
|
|
Thread: Number Series
Post: RE: Number Series
(Jan-17-2019, 01:49 PM)perfringo Wrote: Do you use shebang in you .py file?
Your problem description seems to be similar to the one in StackOverflow
No
(Jan-17-2019, 01:55 PM)MrGoat Wrote: (Jan... |
|
MrGoat |
General Coding Help |
11 |
5,500 |
Jan-17-2019, 01:55 PM |
|
|
Thread: Number Series
Post: RE: Number Series
(Jan-17-2019, 10:22 AM)perfringo Wrote: In snippet you provided this is row #1. Error message states that this is actually row #5. What is on previous four rows?
Nothing ... there is nothing on the... |
|
MrGoat |
General Coding Help |
11 |
5,500 |
Jan-17-2019, 01:38 PM |
|
|
Thread: Number Series
Post: RE: Number Series
It still doesnt work and gives the same error : the error is in the first line of the code " for i in range(7): " , but i can't see what's wrong with it !
for i in range(7):
if i == 3:
co... |
|
MrGoat |
General Coding Help |
11 |
5,500 |
Jan-17-2019, 10:00 AM |
|
|
Thread: Number Series
Post: Number Series
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 i... |
|
MrGoat |
General Coding Help |
11 |
5,500 |
Jan-17-2019, 05:53 AM |
|
|
Thread: Printing out a triangle using nested for loops
Post: RE: Printing out a triangle using nested for loops
What's the difference? I have 2 for loops nested inside a while loop ... that should work right ? Or must it be a for loop nested inside another for loop for it to fit the definition of "nested" ? |
|
MrGoat |
General Coding Help |
12 |
6,579 |
Jan-16-2019, 07:01 PM |
|
|
Thread: Printing out a triangle using nested for loops
Post: RE: Printing out a triangle using nested for loops
I got this warning from the admins : User has been warned for this post. Reason: No BBcode, Creating new threads unnecessarily
What does it mean ? |
|
MrGoat |
General Coding Help |
12 |
6,579 |
Jan-16-2019, 08:28 AM |
|
|
Thread: Printing out a triangle using nested for loops
Post: Printing out a triangle using nested for loops
So, I am supposed to print the below diagram out using nested for loops :
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*
I managed to write a piece of code that could print it out , but n... |
|
MrGoat |
General Coding Help |
12 |
6,579 |
Jan-16-2019, 04:02 AM |
|
|
Thread: Printing out a triangle using nested for loops
Post: RE: Printing out a diamond
Thanks alot, I managed to find the solution. Here it is :
i = 0
while i <= 4:
if i <= 2:
print (("*" * i * 2) + "*")
else:
print ((9 - 2*i) * "*")
i = i + 1Result :... |
|
MrGoat |
General Coding Help |
12 |
6,579 |
Jan-15-2019, 09:48 PM |
|
|
Thread: Printing out a triangle using nested for loops
Post: Printing out a triangle using nested for loops
So I encountered this question : I have to print out a diamond shaped diagram(shown below). How and where do I start ? Any hints ? I am lost completely, don't even know where to start ...
*
***... |
|
MrGoat |
General Coding Help |
12 |
6,579 |
Jan-15-2019, 02:09 PM |
|
|
Thread: 3 random numbers
Post: 3 random numbers
So I was given this question : Pick any 3 random ascending numbers and write out a loop function that prints out all 3 numbers. This was the code and solution presented to me. Can anyone understand it... |
|
MrGoat |
General Coding Help |
1 |
1,977 |
Jan-15-2019, 05:28 AM |