Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Bitnami MediaWiki
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
3619 - Gen Nr Patru Cifre
(section)
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Rezolvare == <syntaxhighlight lang="python" line> def validare_date(c1, c2): # Verificam daca c1 si c2 sunt in intervalul [0,9] if not (0 <= c1 <= 9) or not (0 <= c2 <= 9): return False return True def afisare_numere(c1, c2): # Iteram prin cifrele miilor for m in range(c1, 10): # Iteram prin cifrele sutelor, care sunt egale cu cifrele unitatilor si trebuie sa fie pare for s in range(0, 9, 2): # Iteram prin cifrele zecilor for z in range(c2+1): # Formam numarul de patru cifre cu cifra miilor, cifra sutelor, cifra zecilor si cifra unitatilor num = m*1000 + s*100 + z*10 + s print(num) if __name__ == '__main__': # Citim cifrele c1 si c2 de la tastatura si le convertim la int cifra1, cifra2 = map(int, input("Introduceti cifrele c1 si c2: ").split()) if not validare_date(cifra1, cifra2): print("Datele introduse nu sunt corecte.") return print("Datele introduse sunt corecte.") afisare_numere(cifra1, cifra2) </syntaxhighlight>
Summary:
Please note that all contributions to Bitnami MediaWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Bitnami MediaWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width