Sql questions Question 1


Question 3: Prime Number Generator


Download 67.6 Kb.
bet3/4
Sana31.01.2024
Hajmi67.6 Kb.
#1818450
1   2   3   4
Bog'liq
6afac0bf-38b2-49c5-88da-a3701e407493 5 puzzles

Question 3: Prime Number Generator


Write a Python program that generates prime numbers up to a given.
Your program should:

  1. Prompt the user to enter a positive integer as the upper limit.

  2. Implement algorithm to find all prime numbers up to the specified limit.

  3. Display the list of prime numbers.

For example, if the user enters the limit as 20, the program should output the prime numbers less than or equal to 20: [2, 3, 5, 7, 11, 13, 17, 19].

Question 4: Permutations


Given a string consisting of N pairwise distinct characters, output all the permutations of the characters of this string.
The first line of input contains a string consisting of N characters (1 ≤ N ≤ 8), the characters are letters of the English alphabet and decimal digits.
Output all permutations of the string, one per line. Output the permutations in any order. Do not output one permutation several times and do not output strings that are not permutations of the string in the input.
Example:
Input: abc
Output:
abc
acb
bac
bca
cab
cba

Question 5: City Weather Analysis with Pandas


Consider a DataFrame df with the following columns:
City: The name of a city.
Month: The month in which the data was recorded (e.g., 'January', 'February', etc.).
Temperature: The temperature recorded in Celsius.
Rainfall: The amount of rainfall recorded in millimeters.
Puzzle:
You need to perform the following tasks:

  1. Group by City and Month:

    • Group the DataFrame by 'City' and 'Month'.

    • Calculate the mean temperature and total rainfall for each group.

  2. Filter Data:

    • Create a new DataFrame filtered_df that includes only the rows where the temperature is above 25 degrees Celsius.


  3. Download 67.6 Kb.

    Do'stlaringiz bilan baham:
1   2   3   4




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling