5th day of python challenges 80-87
This commit is contained in:
5
challenges80-87/challenge-080.py
Normal file
5
challenges80-87/challenge-080.py
Normal file
@@ -0,0 +1,5 @@
|
||||
first_name = str(input('Enter your first name : '))
|
||||
print('Your first name length is {0}'.format(len(first_name)))
|
||||
sure_name = str(input('Enter your sure name : '))
|
||||
print('Your surname length is {0}'.format(len(sure_name)))
|
||||
print('{0} {1} name length is {2}'.format(first_name, sure_name, len(first_name+' '+sure_name)))
|
3
challenges80-87/challenge-081.py
Normal file
3
challenges80-87/challenge-081.py
Normal file
@@ -0,0 +1,3 @@
|
||||
school_subject = str(input('Enter your favourite school subject? : '))
|
||||
for i in school_subject:
|
||||
print(i)
|
5
challenges80-87/challenge-082.py
Normal file
5
challenges80-87/challenge-082.py
Normal file
@@ -0,0 +1,5 @@
|
||||
poem = 'Here we stand, and still we fight until we won'
|
||||
print(poem)
|
||||
start_point = int(input('Enter start point in this poem : '))
|
||||
end_point = int(input('Enter end point in this poem : '))
|
||||
print(poem[start_point: end_point])
|
8
challenges80-87/challenge-083.py
Normal file
8
challenges80-87/challenge-083.py
Normal file
@@ -0,0 +1,8 @@
|
||||
string = str(input('Please enter word in upper case ? '))
|
||||
is_upper = False
|
||||
while not is_upper:
|
||||
if string.isupper():
|
||||
is_upper = True
|
||||
else:
|
||||
string = str(input('Sorry not all in upper case, please enter word in upper case ? '))
|
||||
print(string)
|
2
challenges80-87/challenge-084.py
Normal file
2
challenges80-87/challenge-084.py
Normal file
@@ -0,0 +1,2 @@
|
||||
post_code = str(input('Enter your postcode'))
|
||||
print(post_code[0:2])
|
7
challenges80-87/challenge-085.py
Normal file
7
challenges80-87/challenge-085.py
Normal file
@@ -0,0 +1,7 @@
|
||||
name = str(input('Enter your name ? : '))
|
||||
vowel = ['a', 'i', 'e' 'o', 'u']
|
||||
count = 0
|
||||
for i in name:
|
||||
if i.lower() in vowel:
|
||||
count = count + 1
|
||||
print('the number of vowels in your name {0}'.format(count))
|
8
challenges80-87/challenge-086.py
Normal file
8
challenges80-87/challenge-086.py
Normal file
@@ -0,0 +1,8 @@
|
||||
password = str(input('Enter password : '))
|
||||
re_password = str(input('Re-enter password : '))
|
||||
if password == re_password:
|
||||
print('Thank you')
|
||||
elif password != re_password:
|
||||
print('They must be in the same case')
|
||||
else:
|
||||
print('Incorrect')
|
9
challenges80-87/challenge-087.py
Normal file
9
challenges80-87/challenge-087.py
Normal file
@@ -0,0 +1,9 @@
|
||||
string = str(input('Enter a word : '))
|
||||
length = len(string)
|
||||
count = 1
|
||||
for i in string:
|
||||
position = length - count
|
||||
letter = string[position]
|
||||
print(letter)
|
||||
count = count + 1
|
||||
# easy way is type string[::-1]
|
Reference in New Issue
Block a user