Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def create_phone_number(n: list):
- phone_no="(+"
- for a in range (len(n)):
- phone_no += str(n[a])
- if a == 1:
- phone_no += (") ")
- if a==4 or a==7:
- phone_no+=("-")
- return phone_no
- def to_weird_case(my_string: str):
- weird=""
- counter2=0
- for a in range (len(my_string)):
- temp = my_string[a]
- if ord(temp)==32:
- counter2 = 0
- else:
- counter2 += 1
- if counter2%2:
- temp2=temp.upper()
- weird+=(temp2)
- else :
- temp2=temp.lower()
- weird+=(temp2)
- return weird
- print(to_weird_case("Ahoj lidi jak vam to jde"))
- print(create_phone_number([1,2,3,4,5,6,7,8,9,0,1]))
Advertisement
Add Comment
Please, Sign In to add comment