Uploaded by aishaahmed992

odev 1

advertisement
# %% 1 soru
"""world = input("Please enetr the world you want : ")
for x in world :
print(x)"""
# %% 2 soru
"""def printing_E_satrs (quantity,character):
for x in range(0,2):
print()
print(quantity*character*6)
for x in range (0,9):
for y in range(0,9-x):
print(" ",end="")
print(quantity*character)
for x in range(0,2):
print(quantity*character*6)
print()
printing_E_satrs(2,"*")"""
# %%
"""liste =[]
import random
size = int(input("Please enter the size of list : "))
for x in range (0,size):
rand_1_1000 = round(random.uniform(0.0,10000.0), 2)
liste.append(rand_1_1000)
print("list = ",liste)
liste.sort()
print("the sort list = ",liste)"""
# %%
txt = "hitit university"
print(txt.capitalize()) # Converts the first character to upper case
txt1 = "HİTİT UNİVERSİTY"
print(txt.casefold()) # Converts string into lower case
txt2 = "hitit university"
print(txt2.center(20)) # Returns a centered string , in () you write the number of spaces you want
txt3 = "Hitit.I study at Hitit University"
print(txt3.count("Hitit"))#Returns the number of times a specified occurs in a string , in () you write
the world you want to konw the number of times it rewrite
txt4 = "It's çorum"
print(txt4.encode())
# Returns an encoded version of the string
txt5 = "It's çorum."
print(txt5.endswith(".")) # Returns true if the string ends with the specified value , in () your write the
ending of the sentence you want to check if there or not
txt6 = "H\ti\tt\ti\tt\t U\tn\ti\tv\te\tr\ts\ti\tt\ty"
print(txt6.expandtabs(2)) # Sets the tab size of the string , in () you write the number of spaces you
wnat to be between letters
txt7 = "It's çorum"
print(txt7.find("çorum")) # Searches the string for a specified value and returns the position of where
it was found , () you write the world you want to find
txt8 = "is great"
print("python {}".format(txt8)) #Formats specified values in a string , in () the thing that you want to
add
txt9 = "It's çorum"
print(txt9.index("çorum")) # Searches the string for a specified value and returns the position of
where it was found , () you write the world you want to find
txt10 = "Itsçorum"
print(txt10.isalnum()) # Returns True if all characters in the string are alphanumeric
txt11 = "HİTİT UNİVERSİTY"
print(txt11.isalpha()) # Check if all the characters in the text are letters
txt12 ="003"
print(txt12.isdecimal()) #♥(yanlışlıkla bastım öyle çıktı ama güzelmiş) Returns True if all characters
in the string are decimals
txt13 = "9005"
print(txt13.isdigit()) # Returns True if all characters in the string are digits
txt14 = "hitit university"
print(txt14.islower()) # Returns True if all characters in the string are lower case
txt15 = "565543"
print(txt15.isnumeric()) # Returns True if all characters in the string are numeric
txt16 = "My name is Aisha !"
print(txt16.isprintable()) # Check if all the characters in the text are printable
txt17 = ("Aisha","Ahmed","Farag")
print("/".join(txt17)) #Join all items in a tuple into a string, using a hash character as separator, in ()
the name of the tuple you want
txt18 = "Arabic"
x = txt18.ljust(5)
# Return a 5 characters long, left justified version of the word "Arabic"
print(x, "is my favorite language.")
txt19 = "HİTİT UNİVERSİTY"
print(txt19.lower()) #Lower case the string
txt20 = "
Arabic
x = txt20.lstrip()
"
# Remove spaces to the left of the string
print("of all language", x, "is my favorite")
txt21 = "I like Arabic"
x = txt21.replace("Arabic", "English") # Returns a string where a specified value is replaced with a
specified value
print(x)
txt22 = "It's çorum"
print(txt22.rfind("çorum")) # Searches the string for a specified value and returns the last position of
where it was found
txt23 = "It's çorum"
print(txt23.index("çorum")) # Searches the string for a specified value and returns the last position of
where it was found
txt33 = "Hitit.I study at Hitit University"
print(txt33.rpartition("Hitit")) # Returns a tuple where the string is parted into three parts
txt33 = "Hitit. I study at Hitit University"
print(txt33.split(" ")) # Splits the string at the specified separator, and returns a list,
txt5 = "It's çorum."
print(txt5.startswith("I")) # Returns true if the string starts with the specified value
txt20 = "
Arabic
x = txt20.strip()
"
# Returns a trimmed version of the string
print("of all language", x, "is my favorite")
txt = "50"
x = txt.zfill(10) # Fills the string with a specified number of 0 values at the beginning
print(x)
# %%
num = int(input("please enter a number : "))
liste = []
toplam = 0
for x in range(0,num) :
if (x % 2 == 1):
toplam += 1
liste.append(x)
print("Toplam 1 ile {} arasında {} adet asal sayı vardır.".format(num,toplam))
print(liste)
////////////////////////////////////////////////////
Aisha Ahmed Farag
204210753
Download