Jump to content
covor2190

Ajutor in programare.

Recommended Posts

Posted

Salut. Poate cineva sa ma ajute in programare:

Vreau ca dintr-un grup de 30 de numere, programul sa aleaga singur un numar.

Numerele sunt de la 1 la 30, pe 2 culori (rosu si verde), si vreau ca dintr-un interval de 30 de numere, programul sa aleaga automat doar numarul cu verde (cand este disponibil, in majoratatea timpul find rosu, dar la un anumit timp eliberandu-se si un numar cu verde, aleator din cele 30), cand alege singur numarul verde, sa completeze automat toate campurile necesare (gen nume, prenume, etc.) si sa bifeze (nu sunt robot). Gen mai pe scurt, cand din cele 30 de numere rosii, apare un numar verde aleator, programul sa il bifeze singur si sa completeze campurile automat cu datele care le stabilesc eu dinainte.

Multumesc. Daca ma poate ajuta cineva va rog sa imi lasati aici sau direct pe mail:covor2190@gmail.com , voi fi recunoscator. O zi buna la toti!!!

  • Active Members
Posted

Salut,

 

Io n-am inteles nimic din ceea ce vrei.

 

- Care numere sunt verzi si care sunt rosii? 

- Sunt doua seturi de 30 de numere, un set fiind rosu si altul fiind verde?

- Cum determini cand un numar e disponibil?

- De unde au aparut campurile alea? Sunt prin Baragan?

- Etc.

 

Mersi

Posted

Inițial toate numerele de la 1 la 30 sunt roșii. Aleator la un interval de 30 minute, un număr devine verde (gen Nr 16 era roșu, după 30 minute a devenit verde) iar acel număr trebuie selectat automat (asta vreau sa fac prin programare, sa selecteze automat numărul, nu sa stau eu incontinuu sa selectez până devine verde, să aștept) si sa completeze campurile automat (gen numărul 16 daca îl selectezi îți va cere numele și prenumele)

Posted (edited)

Sa mor de nu am ramas in pom

 

On: in ce limbaj?

 

Edit: conctret pentru ce? pentru semafor, instalatie de brad etc..

Edited by Kev
  • Downvote 1
Posted

1)un grup de numere de la 1 la 30 (1,2,3,4,5...28,29,30)
2)numerele sa fie in tabel (linie si coloana, 1,2,3,4(L1)/ 5,6,7,8 (L2) / 9,10,11,12(L3) ... etc. pana la 30)
3)in tabel numerele sa fie reprezentate in culoare rosi (gen numarul sa fie rosu)
4)la interval de 30 minute, un numar din cele 30 (aleator) sa se transforme din culoare rosie in culoare verde
5)programul sa selecteze automat acel numar verde
6)dupa ce a selectat numarul verde, sa completeze campurile necesare, gen cand apesi pe orice numaru(1-30) apare sub tabel un camp in care cere urmatoarele info(nume,prenume,varsta,mail, etc...)
7)dupa ce a completat automat si a bifat numarul verde, o sa apara sub tabel si sub campurile completate anterior, bifare "NU SUNT ROBOT"
 

  • Active Members
Posted (edited)

Cadou de Craciun :) 

 

import random
import sys
import time


# generate numbers from 1 to 30 mapped to red color
NUMBERS = {number: 'red' for number in list(range(1, 31))}


class Colors:
    """
    ANSI color codes.
    """
    # RED is used for all the numbers
    RED = '\033[91m'

    # GREEN is used for displaying computer's random
    # chosen number
    GREEN = '\033[92m'

    # BLUE is used for displaying user's chosen
    # number
    BLUE = '\033[94m'

    END = '\033[0m'


def assign_color_to_number(number, color):
    """
    Show ANSI colors in terminal for nicer UX.
    """
    
    if color == 'red':
        return f'{Colors.RED}{number}{Colors.END}'
    elif color == 'green':
        return f'{Colors.GREEN}{number}{Colors.END}'
    elif color == 'blue':
        return f'{Colors.BLUE}{number}{Colors.END}'
    else:
        return number


def print_table(numbers):
    """
    Print a nice table with colorful numbers wrapped at 5.
    """

    print('\n')
    for number, color in numbers.items():
        number = assign_color_to_number(number, color).ljust(12)
        if number % 5 != 0:
            print(number, end=' ')
        else:
            print(number)
    print('\n')


def countdown(seconds, user_number):
    """
    Let user know how much until the next game.

    Arguments:
        seconds (int): How many seconds until next game.
        user_number (int): User's lucky & chosen number.
    """

    print(f"You chose {user_number}. GOOD LUCK!\n\n")

    for second in range(seconds, -1, -1):
        sys.stdout.write(
            f"\r{second} seconds remaining until one number will change its color to green."
        )
        time.sleep(1)
        sys.stdout.flush()

    print('\n')


def get_user_number():
    """
    Sanitize user's input.
    """

    while True:
        try:
            value = int(input('Please choose a number between 1 and 30: '))
            if 30 < value < 1:
                print("Please insert a number between 1 and 30!\n")
                continue
            return value
        except ValueError:
            print("Please insert a number between 1 and 30!\n")
            continue


def play():
    print_table(NUMBERS)

    user_number = get_user_number()
    countdown(5, user_number)

    random_number = random.randint(1, 30)

    if user_number != random_number:
        NUMBERS.update({random_number: 'green', user_number: 'blue'})
        print_table(NUMBERS)
        print(
            f'You did not guess the number. Our number was: {random_number} '
            f'and yours was: {user_number}.\n\nGOOD LUCK NEXT TIME'
        )
    else:
        print(
            'You guessed it! Congrats! Please fill in the information '
            'below in order to receive your prize.\n\n'
        )

        name = input('Your name: ')
        age = input('Your age: ')
        email = input('Your email: ')

        print(f'Name: {name}\nAge: {age}\nEmail:{email}')

    # reset our numbers
    NUMBERS.update({random_number: 'red', user_number: 'red'})


def main():
    print('\nWELCOME TO LOTTERY!')

    while True:
        play()
        answer = input('Play again? [Y]es/[N]o: ')

        if answer.lower() == 'n':
            break

    print('\nTHANKS FOR PLAYING!')

    
if __name__ == '__main__':
    main()

 

Aici ai si link cu codu' si poti sa ii dai un Run de test. Am pus si niste comment-uri in caz ca vrei sa intelegi ce se intampla, desi ma indoiesc.

 

PS: Codu' e scris destul de repede but it does it job chiar daca nu e perfect organizat.

 

Enjoy :) 

Edited by MrGrj
  • Upvote 1
Posted
2 hours ago, MrGrj said:

Cadou de Craciun :) 

 


import random
import sys
import time


# generate numbers from 1 to 30 mapped to red color
NUMBERS = {number: 'red' for number in list(range(1, 31))}


class Colors:
    """
    ANSI color codes.
    """
    # RED is used for all the numbers
    RED = '\033[91m'

    # GREEN is used for displaying computer's random
    # chosen number
    GREEN = '\033[92m'

    # BLUE is used for displaying user's chosen
    # number
    BLUE = '\033[94m'

    END = '\033[0m'


def assign_color_to_number(number, color):
    """
    Show ANSI colors in terminal for nicer UX.
    """
    
    if color == 'red':
        return f'{Colors.RED}{number}{Colors.END}'
    elif color == 'green':
        return f'{Colors.GREEN}{number}{Colors.END}'
    elif color == 'blue':
        return f'{Colors.BLUE}{number}{Colors.END}'
    else:
        return number


def print_table(numbers):
    """
    Print a nice table with colorful numbers wrapped at 5.
    """

    print('\n')
    for number, color in numbers.items():
        number = assign_color_to_number(number, color).ljust(12)
        if number % 5 != 0:
            print(number, end=' ')
        else:
            print(number)
    print('\n')


def countdown(seconds, user_number):
    """
    Let user know how much until the next game.

    Arguments:
        seconds (int): How many seconds until next game.
        user_number (int): User's lucky & chosen number.
    """

    print(f"You chose {user_number}. GOOD LUCK!\n\n")

    for second in range(seconds, -1, -1):
        sys.stdout.write(
            f"\r{second} seconds remaining until one number will change its color to green."
        )
        time.sleep(1)
        sys.stdout.flush()

    print('\n')


def get_user_number():
    """
    Sanitize user's input.
    """

    while True:
        try:
            value = int(input('Please choose a number between 1 and 30: '))
            if 30 < value < 1:
                print("Please insert a number between 1 and 30!\n")
                continue
            return value
        except ValueError:
            print("Please insert a number between 1 and 30!\n")
            continue


def play():
    print_table(NUMBERS)

    user_number = get_user_number()
    countdown(5, user_number)

    random_number = random.randint(1, 30)

    if user_number != random_number:
        NUMBERS.update({random_number: 'green', user_number: 'blue'})
        print_table(NUMBERS)
        print(
            f'You did not guess the number. Our number was: {random_number} '
            f'and yours was: {user_number}.\n\nGOOD LUCK NEXT TIME'
        )
    else:
        print(
            'You guessed it! Congrats! Please fill in the information '
            'below in order to receive your prize.\n\n'
        )

        name = input('Your name: ')
        age = input('Your age: ')
        email = input('Your email: ')

        print(f'Name: {name}\nAge: {age}\nEmail:{email}')

    # reset our numbers
    NUMBERS.update({random_number: 'red', user_number: 'red'})


def main():
    print('\nWELCOME TO LOTTERY!')

    while True:
        play()
        answer = input('Play again? [Y]es/[N]o: ')

        if answer.lower() == 'n':
            break

    print('\nTHANKS FOR PLAYING!')

    
if __name__ == '__main__':
    main()

 

Aici ai si link cu codu' si poti sa ii dai un Run de test. Am pus si niste comment-uri in caz ca vrei sa intelegi ce se intampla, desi ma indoiesc.

 

PS: Codu' e scris destul de repede but it does it job chiar daca nu e perfect organizat.

 

Enjoy :) 

mersi frumos, o intrebare,cum as putea lega acest cod sa functioneze pe un site web? mersi inca odata pentru ajutor

gen vreau ca la un site care are doar grupul de nr, sa leg acest cod sa functioneze

  • Active Members
Posted

In viata Dumnezeu iti da, da' nu-ti baga si-n gura. Fa si tu ceva research sau pune pe cineva sa iti faca asta contra-cost :) Nu e ca si cum ai intreba pe cineva: "Cum fac o ciocolata calda" si gata. Tre' sa pui ceva efort in asta. Good luck.

 

  • Upvote 4
Posted

Nimeni nu intelege pt ca covor are 0 skill in a explica ce vrea.

 

1. Unde sunt numerele? Da link.

2. pune o poza. ce culoare? ce site? ce date?

3. pune un video cu tine facand ce vrei sa-ti faca scriptul.

 

Nu avem noi citotor de minti sa stim daca e un joc video, o tema la liceu, un site web, aparatul de pacanele din bar, etc.

 

Eu cred ca el are un site cu giveaway sau ceva de genul. si vrea sa-l fraiereasca.

 

I-ati adio. butonul ala ce "nu sunt robot" de la google e ft ft greu de automatizat.

nu-ti gasesti cuneva sa-ti bifeze butonul sub 200€

Posted (edited)
1 hour ago, yoyois said:

I-ati adio. butonul ala ce "nu sunt robot" de la google e ft ft greu de automatizat.

nu-ti gasesti cuneva sa-ti bifeze butonul sub 200€

 

http://www.megatypers.com

 

https://rstforums.com/forum/topic/47808-cum-sa-faci-bani-rezolvand-captcha-uri/?tab=comments#comment-316622

 

Fix 200 

 

"munca de chinezi"

 

/pentru viitor, invatati limbajele cel putin la un low-level, iar ulterior puneti intrebari

 

 

Edited by Kev
  • Downvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...