write a program to generate a Fibonacci Series in python. #shorts

preview_player
Показать описание
write a program to generate a Fibonacci Series in python.
write a program to print Fibonacci series in python using for loop.
Fibonacci series in python using range.
Fibonacci series.
@CodeWithShahrukh
#CoseWithShahrukh
#shorts
#shortsvideo
#shortsyoutube
#youtubeshorts
#youtube
#viral
#viralvideo
#viralshorts
Рекомендации по теме
Комментарии
Автор

import random

def guess_the_number():
secret_number = random.randint(1, 10)
attempts = 0

print("Welcome to Guess the Number!")

while True:
try:
guess = int(input("Guess the number between 1 and 10: "))
attempts += 1

if guess == secret_number:
print(f"Congratulations! You guessed the number in {attempts} attempts.")
break
elif guess < secret_number:
print("Too low. Try again.")
else:
print("Too high. Try again.")
except ValueError:
print("Please enter a valid number.")

if __name__ == "__main__":
guess_the_number()

Noob
Автор

#include <iostream>
#include <cstdlib>
#include <ctime>

int main() {
// Seed for random number generation
std::srand(std::time(0));

// Generate a random number between 1 and 100
int secretNumber = std::rand() % 100 + 1;

int guess;
int attempts = 0;

std::cout << "Welcome to the Number Guessing Game!\n";

do {
std::cout << "Enter your guess (between 1 and 100): ";
std::cin >> guess;

attempts++;

if (guess == secretNumber) {
std::cout << "Congratulations! You guessed the correct number in " << attempts << " attempts.\n";
} else if (guess < secretNumber) {
std::cout << "Too low! Try again.\n";
**⬤**

Noob
welcome to shbcf.ru