you cannot use built-in functions or NumPy or Pandas!
1. Write a function which finds all Pythagorean triplets of triangles whose sides are no greater than a natural number N.
2. Given a list of integers, write a function that finds the smallest and the largest value of this list. Given a list of numbers, write a function which finds their standard deviation
by CodeChum Admin
Now this one's a tad bit tricky, but you can definitely do it!
Instructions:
Input
A line containing five integers separated by a space.
1·2·3·4·5
Output
A line containing an integer.
4084101
by CodeChum Admin
We've tried adding together integers, now how about strings?
Instructions:
Input
A line containing two strings separated by a space.
hello·world
Output
A line containing the concatenated string with no spaces.
helloworld
even or odd . write a program to check if the given number is even or odd
You task is to write a program that will continuously add friend data to a list named friends until the user enters "No". The program must display the contents of friend list.
friend's data to be collected:
Last name
First name
Birthdate
Gender
Contact No.
Validation:
Name must not be empty.
Must check the validity of the birth date.
Gender either F or M only.
Contact No. must be exactly 11 digits.
Display "Invalid Input" and ask the user to input another value.
Input
Friend's data
Tortor
Rhea
12/25/1990
F
09172345678
Yes
Nayang
Iya
11/11/1995
F
09172415679
No
Output
Name: Rhea Tortor
Birthdate: December 25, 1990
Gender: Female
Contact No.: 09172345678
Name: Iya Nayang
Birthdate: November 11, 1995
Gender: Female
Contact No.: 09172415679
given integer n as input.write a program to print the sum of series of 1+11+111+...n terms
by CodeChum Admin
Now that we're done with integers, we're moving on to decimals!
Instructions:
Input
A line containing three decimal numbers with two decimal places separated by a space.
1.53·2.25·1.23
Output
A line containing the result with two decimal places.
2.80
Problem 1: Write a program that takes a positive integer as input and prints its factorial. Write two separate functions, one that computes the factorial iteratively, and the other recursively. Problem 2: Write a program to print the first n Fibonacci numbers. Write separate iterative and recursive versions. Which version do you suspect is more efficient ? Why ? Problem 3: Write a program that tests if a number is prime or not. Input a number from the user. The output should be ‘True’ if the number is a prime, ‘False’ otherwise. Problem 4: Write a program to sort a list of integers using Insertion sort, Mergesort and Quicksort. First take as input the size ‘n’ of the array, then read in the ‘n’ input integers that need to be sorted. Problem 5: Devise an experiment to verify that the runtime of the list index operator is indeed O(1), You might want to read sections 3.5 and 3.6 of Miller and Ranum’s online book.
Devise an experiment to verify that the runtime of the list index operator is indeed O(1), You might want to read sections 3.5 and 3.6 of Miller and Ranum’s online book.
Write a program to sort a list of integers using Insertion sort, Mergesort and Quicksort. First take as input the size ‘n’ of the array, then read in the ‘n’ input integers that need to be sorted.