mirror of
https://github.com/arthur-pbty/nsi.git
synced 2026-06-03 23:36:19 +02:00
renamed files and exercise 1.2
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
# Display the size in bytes and bits of a 536 kio file.
|
||||
# 1 kio (1 kibioctet) = 210 bytes
|
||||
# 1 byte = 1 byte = 8 bits
|
||||
|
||||
bool = True
|
||||
while bool:
|
||||
try:
|
||||
fichier = int(input("What is the size of your file in kio? "))
|
||||
print("Fichier :", fichier, "kio", "=", fichier * 2**10, "octets", "=", fichier * 8 * 2**10, "bits")
|
||||
bool = False
|
||||
except:
|
||||
print("You had to enter a number. Example: 536")
|
||||
@@ -0,0 +1,18 @@
|
||||
# The social security number is made up of 13 digits plus the control key (2 digits).
|
||||
# Example: 1 89 11 26 108 268 91
|
||||
# The control key is calculated using the formula :
|
||||
# Key = 97 - (social security number modulo 97)
|
||||
# Find the control key for your social security number.
|
||||
# Why use the control key?
|
||||
|
||||
bool = True
|
||||
while bool:
|
||||
try:
|
||||
cle = int(input("What is your control key? "))
|
||||
res = 97 - cle%97
|
||||
print("The control key for", cle, "is", res)
|
||||
bool = False
|
||||
except:
|
||||
print("You had to enter a key. Example: 1891126108268")
|
||||
|
||||
# The purpose of the control key is to verify the validity of the social security number.f
|
||||
@@ -0,0 +1,5 @@
|
||||
from math import *
|
||||
a = sqrt(4.6**3 - 15/16)
|
||||
print(a)
|
||||
if a == 9.818273779030608:
|
||||
print("C'est bien égale")
|
||||
@@ -0,0 +1,4 @@
|
||||
prenom = "Léa"
|
||||
nom = "Martin"
|
||||
|
||||
print(prenom[0], nom[0])
|
||||
@@ -0,0 +1,4 @@
|
||||
prenom = "Alexandre"
|
||||
nom = "Lecouturier"
|
||||
|
||||
print(prenom, nom, "a pour identifiant ",prenom[0:3].lower() + "." + nom.lower())
|
||||
@@ -0,0 +1,12 @@
|
||||
identifiants = {
|
||||
"ale.lecouturier":"Huz4",
|
||||
"lea.martin":"monty"
|
||||
}
|
||||
|
||||
identifiant = input("Identifiant : ")
|
||||
motdepasse = input("Mot de passe : ")
|
||||
|
||||
if identifiant in identifiants and motdepasse == identifiants[identifiant]:
|
||||
print(True)
|
||||
else:
|
||||
print(False)
|
||||
@@ -0,0 +1,39 @@
|
||||
identifiants = {
|
||||
"ale.lecouturier":"Huz4",
|
||||
"lea.martin":"monty"
|
||||
}
|
||||
|
||||
#identifiant = input("Identifiant : ")
|
||||
#motdepasse = input("Mot de passe : ")
|
||||
|
||||
def f():
|
||||
if identifiant.get() in identifiants and motdepasse.get() == identifiants[identifiant]:
|
||||
print(True)
|
||||
else:
|
||||
print(False)
|
||||
|
||||
|
||||
from tkinter import *
|
||||
|
||||
fenetre = Tk()
|
||||
|
||||
label = Label(fenetre, text="Identifiant :")
|
||||
label.pack()
|
||||
|
||||
|
||||
identifiant = Entry(fenetre, width=30)
|
||||
identifiant.pack()
|
||||
|
||||
|
||||
|
||||
label = Label(fenetre, text="Mot de passe :")
|
||||
label.pack()
|
||||
|
||||
|
||||
motdepasse = Entry(fenetre, width=30)
|
||||
motdepasse.pack()
|
||||
|
||||
bouton = Button(fenetre, text="Se connecter", command=f)
|
||||
bouton.pack()
|
||||
|
||||
fenetre.mainloop()
|
||||
Reference in New Issue
Block a user