Please do this in Python Programming and provide screenshots The output should be exact same like in the examples. If the output in the example is in 2 decimals, then it should be like that. 1g - Alphabet Write a program that prints the alphabet on a single line. Do not write the alphabet as a literal string, instead use the ord() and chr() functions. Type help(ord) or help(chr) in IPython (called python console in PyCharm, button at the bottom of the screen by default) to get info on what these functions do. You should get the following output: abcdefghijklmnopqrstuvwxyz Put your program in alphabet.py 1h - Collatz One of the most renowned unsolved problems in mathematics is the Collatz conjecture. The problem is stated as follows: Start out with some number n. Apply the following rule repeatedly to the number: if n is even, the next number is n/2 if n is odd, the next number is 3n + 1 This will give us a list of numbers. For example, when starting with 11 the list will be 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 4 2 1 4 2 1 ... Once the sequence has reached 1, it will repeat 4, 2, 1 indefinitely. The conjecture is that no matter which starting number you pick, the sequence will reach 1 eventually. This conjecture is probably correct. Using computers all numbers up to 268268 have been found to reach 1. Note that 268268 is quite a large number: it is about 40 times the number of grains of sands on earth, or 4 times the number of stars in the universe. If you can check 1 number per nanosecond, trying all 268268 numbers takes you about 10,000 (10 thousand) years. This problem is very simple to state, but no one has proved the conjecture since Collatz stated it in 1937. There have even been mathematicians that have spent years of continued study on the conjecture, without success. Fortunately, writing a program that generates the Collatz sequence is a lot less challenging. Write a program that takes any positive integer and prints the corresponding Collatz sequence up to and including the first one. Example: Please enter a number: 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 Put your program in collatz.py. Use the % (modulo) operator to determine if a number is odd or even. Use print(n, end = " ") to print without a new line afterward, but with a space instead.
- Please do this in Python Programming and provide screenshots
- The output should be exact same like in the examples.
- If the output in the example is in 2 decimals, then it should be like that.
1g - Alphabet
Write a program that prints the alphabet on a single line. Do not write the alphabet as a literal string, instead use the ord() and chr() functions. Type help(ord) or help(chr) in IPython (called python console in PyCharm, button at the bottom of the screen by default) to get info on what these functions do.
You should get the following output:
abcdefghijklmnopqrstuvwxyz
Put your program in alphabet.py
1h - Collatz
One of the most renowned unsolved problems in mathematics is the Collatz conjecture. The problem is stated as follows:
Start out with some number n.
Apply the following rule repeatedly to the number:
- if n is even, the next number is n/2
- if n is odd, the next number is 3n + 1
This will give us a list of numbers. For example, when starting with 11 the list will be
11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 4 2 1 4 2 1 ...
Once the sequence has reached 1, it will repeat 4, 2, 1 indefinitely. The conjecture is that no matter which starting number you pick, the sequence will reach 1 eventually.
This conjecture is probably correct. Using computers all numbers up to 268268 have been found to reach 1. Note that 268268 is quite a large number: it is about 40 times the number of grains of sands on earth, or 4 times the number of stars in the universe. If you can check 1 number per nanosecond, trying all 268268 numbers takes you about 10,000 (10 thousand) years.
This problem is very simple to state, but no one has proved the conjecture since Collatz stated it in 1937. There have even been mathematicians that have spent years of continued study on the conjecture, without success. Fortunately, writing a program that generates the Collatz sequence is a lot less challenging.
Write a program that takes any positive integer and prints the corresponding Collatz sequence up to and including the first one.
Example:
Please enter a number: 11
34 17 52 26 13 40 20 10 5 16 8 4 2 1
Put your program in collatz.py. Use the % (modulo) operator to determine if a number is odd or even.
Use print(n, end = " ") to print without a new line afterward, but with a space instead.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
do by c++ Programming please
0
Output:Invalid
1
847
Output:Invalid
Input
1
77
Output:
63
Input
2
(-54)
Output:
Negative
Input
2
97
Output:141
#include <iostream>
#include <cmath>
#include <cstdlib>
using namespace std;
int main()
{
//Start your code here
return 0;
}