Education › Re: Total Scholarship 2020/2021 Discussion Thread by SPLENDID25(m): 11:59am On Oct 09, 2020 |
y
|
Phones › Re: Is Sony Experia Phones Durable Maintenance Wise by SPLENDID25(m): 9:27pm On Oct 05, 2020 |
ChikezieU: Enugu that's cool. new or fairly used? |
Phones › Re: Is Sony Experia Phones Durable Maintenance Wise by SPLENDID25(m): 3:39pm On Oct 04, 2020 |
ChikezieU: Good morning house please how good and reliable is Sony Experia/Ericsson phone's. As phones are becoming expensive now, Sony Experia seems to be more affordable now, for instance Experia AX is 25k. where? |
Career › Re: What Would Your Occupation Be If You Followed Your Childhood Dream? by SPLENDID25(m): 7:01pm On Sep 15, 2020 |
always wanted to become a mechanical engineer since I began reading written words .....but currently at the verge of becoming an electrical engineer, by His grace. |
Education › Re: Nnpc/snepco And Seplat Scholarship Discussion Thread 2020. by SPLENDID25(m): 6:40pm On Aug 30, 2020 |
|
Programming › Re: Please Help With This by SPLENDID25(op): 9:42am On Aug 20, 2020 |
codeigniter: def collatz (): if number % 2 == 0: return number // 2 elif number % 2 == 1: return 3 * number + 1
number = int(input())
while number != 1: number = collatz () print(number)
sorry for d indentation I have answer dis question b4,
before u ask question use the search bar to see if such question has not been asked before
join www.africonn.com I hope this helps Taofeekdboy: I will give you a hint, the best to use for this practice is recursive function. It calls itself. Please read more on it. saheedniyi22: I remember this from automate the boring stuff with Python, I couldn't solve it then let me try it now. Najdorf: It hasn't been proved that it works for all positive integers.
What's the problem though? The problem looks straightforward. stanliwise: @SPLENDID25 What have you coded so far?. Are you experiencing some issues or what? I successfully written the program. Thanks to everyone for his or her contributions. |
Programming › Re: Please Help With This by SPLENDID25(op): 5:21pm On Aug 19, 2020 |
stanliwise: if it fails to return 1 then it means your loop is infinite. Try to input value that could make your function return 1 def collatz (number): if number % 2 == 0: return number // 2 else: return 3 * number + 1 number = int(input()) collatz (number) print (collatz (number)) while collatz (number) != 1: print (collatz (number)) the program above did with 2 as input, but if the returned value isn't 1, it prints the returned value infinitely. |
Programming › Re: Please Help With This by SPLENDID25(op): 4:54pm On Aug 19, 2020 |
codeigniter: is that not the problem u want to solve I mean, using your code. Every input returned 1 and the program terminates. its not supposed to be that way. |
Programming › Re: Please Help With This by SPLENDID25(op): 4:49pm On Aug 19, 2020 |
stanliwise: When is your while loop suppose to terminate? when the returned value equals 1. |
Programming › Re: Please Help With This by SPLENDID25(op): 4:38pm On Aug 19, 2020 |
stanliwise: use the input() functionality. To get integer you can use: int(input(“input a number”))
Just store it a variable and you can attach it to a while loop to keep calling it. def collatz (number): if number % 2 == 0: return number // 2 else: return 3 * number + 1 number = int(input()) I used the while loop, followed by invoking the function. all it did was to continue printing the returned value. |
Programming › Re: Please Help With This by SPLENDID25(op): 4:21pm On Aug 19, 2020 |
codeigniter: def collatz (): if number % 2 == 0: return number // 2 elif number % 2 == 1: return 3 * number + 1
number = int(input())
while number != 1: number = collatz () print(number)
sorry for d indentation I have answer dis question b4,
before u ask question use the search bar to see if such question has not been asked before
join www.africonn.com I hope this helps Sir, every input returned 1 and the program ends. |
Programming › Re: Please Help With This by SPLENDID25(op): 4:18pm On Aug 19, 2020 |
Taofeekdboy: I will give you a hint, the best to use for this practice is recursive function. It calls itself. Please read more on it. okay I will. thanks |
Programming › Re: Please Help With This by SPLENDID25(op): 4:07pm On Aug 19, 2020 |
|
Programming › Re: Please Help With This by SPLENDID25(op): 6:31pm On Aug 18, 2020 |
Najdorf: It hasn't been proved that it works for all positive integers.
What's the problem though? The problem looks straightforward. I need hints on how to go about the problem. I have been thinking, for the past three days now. |
Programming › Re: Please Help With This by SPLENDID25(op): 6:28pm On Aug 18, 2020 |
stanliwise: @SPLENDID25 What have you coded so far?. Are you experiencing some issues or what? I am actually a beginner. its actually a practice problem. I was able to write the function, but unable to write the part that should call the function and ask for an input provided the returned value isn't 1. I need hints from seniors. |
Programming › Please Help With This by SPLENDID25(op): 11:37am On Aug 17, 2020 |
Write a function named collatz() that has one parameter named number. If number is even, then collatz() should print number // 2 and return this value. If number is odd, then collatz() should print and return 3 * number + 1. Then write a program that lets the user type in an integer and that keeps calling collatz() on that number until the function returns the value 1. (Amazingly enough, this sequence actually works for any integer—sooner or later, using this sequence, you’ll arrive at 1! Even mathematicians aren’t sure why. Your program is exploring what’s called the Collatz sequence, sometimes called “the simplest impossible math problem.”) Remember to convert the return value from input() to an integer with the int() function; otherwise, it will be a string value. Hint: An integer number is even if number % 2 == 0, and it’s odd if number % 2 == 1. |
Education › Re: Nnpc/snepco And Seplat Scholarship Discussion Thread 2020. by SPLENDID25(m): 4:52pm On Aug 01, 2020 |
Loris576: Seriously ? Has spdc shortlisted ? did you apply for snepco? if yes steps and hints please. Anyone seeing this and has applied can also say something. |
Education › Re: Nnpc/snepco And Seplat Scholarship Discussion Thread 2020. by SPLENDID25(m): 4:49pm On Aug 01, 2020 |
mujibson: 4.76 is kinda competitive. Let's hope they've not clandestinely shortlisted those they need.
About the snepco. I've uploaded all my documents and details on scholastica since last year. The only thing I added this year was my 100l Cgpa. Since I've uploaded all the necessary documents earlier, all I just did for Snepco application was clicking the 'Apply button' and I submitted. I don't know much about the procedure. ok |
Education › Re: Nnpc/snepco And Seplat Scholarship Discussion Thread 2020. by SPLENDID25(m): 4:29pm On Aug 01, 2020 |
mujibson: A friend said he knows someone who is shortlisted. I don't know if it's true though. Just that anything can happen. Shell is the most competitive scholarship scheme.
By the way, what's your CGPA and jamb score? Let's start from that. my jamb score is 234, and my 100level cgpa is 4.76. meanwhile, i am finding it difficult applying(i can't find the 'submit' button) for the nnpc/snepco. Hints and brief procedure will be highly appreciated. |
Education › Re: Nnpc/snepco And Seplat Scholarship Discussion Thread 2020. by SPLENDID25(m): 11:12am On Aug 01, 2020 |
has shell spdc shortlisted applicants names for the 2019/2020 that ended February this year scholarship award? |
Education › Re: Seplat Joint Venture 2020/2021 Scholarship Application Is Ongoing by SPLENDID25(m): 12:27pm On Jul 30, 2020 |
yusman14: Yeah... me too please, Valentinefelix6@gmail.com |
|
|
|
|
Education › Re: Young Man Built A Toilet That Generate Cooking Gas And Electricity by SPLENDID25(m): 3:27pm On Jul 27, 2020 |
Maj196: Methane gas (CH4) exactly, even corpse can go up on flames. |
|
|
Education › Re: Who Can Solve This Conversion Please... It's Urgent by SPLENDID25(m): 12:29pm On Jul 24, 2020 |
marveworld is right. no.2 is 1.2056 |
Education › H by SPLENDID25(op): 11:23am On Jul 24, 2020*. Modified: 12:12pm On Apr 03, 2021 |
?? |
|
|