0% found this document useful (0 votes)
2 views13 pages

Document Python

The document is a Python script that covers various programming concepts including variable declaration, data types, arithmetic operations, string manipulation, and conditional statements. It demonstrates the use of different data types such as integers, floats, and strings, along with their respective operations and methods. Additionally, it includes examples of logical operations and conditions to evaluate expressions.

Uploaded by

chumaadolphe04
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views13 pages

Document Python

The document is a Python script that covers various programming concepts including variable declaration, data types, arithmetic operations, string manipulation, and conditional statements. It demonstrates the use of different data types such as integers, floats, and strings, along with their respective operations and methods. Additionally, it includes examples of logical operations and conditions to evaluate expressions.

Uploaded by

chumaadolphe04
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

ob = " data analyst"

print(job)

age = 30

print(age)

name, age, majority = "sebastien", 30, True

print(name)

print(age)

print(majority)

lang1 = lang2 = lang3 = "english"

print(lang1)

print(lang2)

print(lang3)

#valeur numeric

#float and int

#float== valeur à virgule

#int== valeur sans virgule

number = 1

print(number + 1)

print(type(number))

print(type(job))

#type == afficher la nature de la valeur === float ou int

motivationScore = 80

print(motivationScore)

print(type(motivationScore))
coffeBoost = 1.25

print(coffeBoost)

print(type(coffeBoost))

number = 3+3

print(number)

number = 3-6

print(number)

number = 1/3

print(number)

number = 3*3

print(number)

number = 5//2

# use // pour arrondire

print(number)

number = ((2+3)*5)/2

#juste faire le calcule en suivant le meme regle de calcul

print(number)

number = 5/(-2)

#mettre en paranthese la valeur negative pour que ça fontionne

print(number)

number = 2**3

# ** signifie mettre à l'exposant

print(number)

number = 10%3

# % pour donner juste le reste de la division

print(number)

number = 10%5

print(number)
motivationScore = 80

coffeBoost = 1.25

finalMotivationScore = motivationScore * coffeBoost

print(finalMotivationScore)

print(type(finalMotivationScore))

#les strings == valeur mot

job = 'data scientist'

print(job)

job = "data analyst"

print(job)

darkVador = "luc, i'm your father"

print(darkVador)

darkVador = 'luc, i\'m your father'

print(darkVador)

luc = 'no.... that\'s impossible.... nooooooooo\

ooooooooooooooooooooooo'

print(luc)

luc = """

no.... that\'s impossible.... nooooooooo

ooooooooooooooooooooooo

ooooooooooo

ooooo

oo

"""

print(luc)
#maniûler un string

#1 recuberer une lettre alfabetique

job = 'data scientist'

print(job)

print(job[0])

print(job[2])

print(job[1:7])

print(job[:7])

print(job[3:])

#len == doner le nombre de caractere d'une texte ça compte de 0 à .........

print(len(job))

# .lower() mettre en miniscule

print([Link]())

# .upper() mettre en majuscule

print([Link]())

# .strip() supprimer les espaces

print(" hello word".strip())

# .replace() repace une valeur de la variable

print([Link]('a','A'))

# .split() decouper un element et le mettre de coté

print([Link]('a'))

# concatenation concatenate

start = "luc, I\'m"

end = 'your father'


darkVador = start+end

print(darkVador)

darkVador = start+ ' '+end

print(darkVador)

name = "dolf"

print(f"bonjour, je suis {name}")

name = 'luc'

function = "father"

darkVador = f"{name}, i'm your {function }"

print(darkVador)

# miltiplier une valeur pour l'afficher beaucoup

luc = "N" + ("o"*10)

print(luc)

#verifer le type d'une variable et la modifier

#text = "job" + 'learningMotivation ? ' + finalMotivationScore + '% !'

#print(text)

#verifier le type de la variable

print(type(finalMotivationScore))

print(type(job))

print(type(1))

#modifier le type de la variable

#float === changer un entier ( int) en decimal

age = 30

print(float(age))
age = float(30)

print(age)

# int === changer une variable decimale en entier

age = 2.4

print(int(age))

age = int(2.4)

print(age)

text = "job" + 'learningMotivation ? ' + str(finalMotivationScore) + '% !'

print(text)

text = "job" + 'learningMotivation ? ' + str(int(finalMotivationScore)) + '% !'

print(text)

#save la valeur de la variable

finalMotivationScore = type(int(finalMotivationScore))

print(finalMotivationScore)

#le dernier valeur de la variable qui devient conu dans le code

number = 1.1

print(number)

print(type(number))

number = 1

print(number)

print(type(number))

'''

print("hello")
'''

#### condition

is_student = True

is_licence = False

age = 12

if age >= 18:

print("your\'re adult")

else:

print("you\'re not adult")

test1 = True

print(test1)

print(type(test1))

test2 = False

print(test2)

print(type(test2))

# == egalite

test1 = "data"

test2 = "data"

test = test1 == test2

print(test)

test1 = "data"

test2 = "datas"

test = test1 == test2

print(test)
test1 = 'data'

test2 = 'Data'

test = test1 == test2

print(test)

print(type(test))

number1 = 50

number2 = 50

number = number1 == number2

print(number)

print(type(number))

number1 = 50

number2 = 5

number = number1 == number2

print(number)

print(type(number))

number1 = 50.5

number2 = 50.5

number = number1 == number2

print(number)

print(type(number))

number1 = 50.4

number2 = 50.7

number = number1 == number2

print(number)

print(type(number))
number1 = 50

number2 = 50.0

number = number1 == number2

print(number)

print(type(number))

number1 = 50

number2 = '50'

number = number1 == number2

print(number)

print(type(number))

# != is not egal (different)

test1 = 'data'

test2 = 'data'

test = test1 != test2

print(test)

test1 = 'data'

test2 = 'datas'

test = test1 != test2

print(test)

# < inferior

# > superior

# == egal

# != diffrent

# <= inferieur or egal

# >= superior or egal

print("welcome in logic")
A = 10

B = 20.1

C = B == A

print(C)

D = B != A

print(D)

E=B>A

print(E)

F=B<A

print(F)

AB = 30

AC = 30

AS = AB <= AC

print(AS)

# >= superior or egal

print("welcome in logic")

A = 10

B = 20.1

C = B == A

print(C)

D = B != A

print(D)

E=B>A

print(E)

F=B<A

print(F)

AB = 30
AC = 30

AS = AB <= AC

print(AS)

AB = 30

AC = 39

AS = AB <= AC

print(AS)

AB = 30

AC = 39

AS = AB >= AC

print(AS)

# True and And logic of + and *

a = 10

b=1

c=2

d = a < b and b < c

print(d)

print("test")

age = 22

is_student = True

discount = age > 25 and is_student

print(discount)

print("test")

age = 26

is_student = True

discount = age > 25 and is_student


print(discount)

a = 12

b = 10

c=3

d = a > b or b > a

print("test")

age = 22

is_student = True

discount = age > 25 and is_student

print(discount)

age = 70

enter = age < 12 or age > 65

print(enter)

a = False and True

print(a)

a = False or True

print(a)

a = (True and False) or True

print(a)

year_of_service = 6

project_termine = False

evaluation_exceptionnel = True

congesSupp = year_of_service > 5 and (project_termine or evaluation_exceptionnel)

print(congesSupp)
moyenne = 88

activity_paraschool = 3

chef_class = False

borce = (moyenne > 85 and activity_paraschool >= 2) or (moyenne > 90 or


chef_class )

print(borce)

You might also like