0% found this document useful (0 votes)
11 views7 pages

Python Programme Challenges

Uploaded by

itssaara09
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)
11 views7 pages

Python Programme Challenges

Uploaded by

itssaara09
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
You are on page 1/ 7

LEVEL 1

1.
name=input('what is your full name? ')
age=int(input('how old are you? '))
fc=input('what is your favourite colour')

2.
name=input('what is your name? ')
print('welcome',name)

3.
name=input('what is your first name? ')
print('welcome',name)
name2=input('what is your last name? ')
print('this is your last name maryam',name2)

4.
name=input('what is your first name? ')
print('welcome',name)
name2=input('what is your last name? ')
print('this is your name',name,name2)
LEVEL 2

1.
distance=int(input('what is the distance in metres? '))
time=int(input('what is the time in seconds did it take? '))
sum=distance/time
print('this is the average speed',sum)

2.
f=input('what is your first name? ')
s=input('what is your last name? ')
n1=f[:3]
n2=s[-2:]
print('this your username',n1+n2 )

3.
f=input('what is your first name? ')
s=input('what is your last name? ')
n1=f[:3]
n2=s[-2:]
from random import randint
number=randint(100,999)

print('hello',f+s,'this is your username',n1+n2,number )

LEVEL 3
1.
time=int(input('how much time in minutes do you spend on calls in a month ? '))
text=int(input('how many texts do you send every month ? '))
n1=time*0.10
n2=text*0.05
n3=10.00+n1+n2
print('the phone bill will be about',n3)

2.
a='maryam'
name=input('what is your name?')
if name== a:
print('Your cool')
else:
print('nice to meet you')

LEVEL 4
1.
num1=int(input('Enter a random number between 1-50: '))
num2=int(input('Enter a second random number between 1-50: '))
if num1 <= num2:
print(num2,'is the largest number')
else:
print(num1,'is the largest number')

2.
from random import randint number=randint(1,10)
num1= input("Guess the number")
if num1==number:
print("correct")
else:
print("Not what I was thinking")
LEVEL 5

1.
l=input('what is the traffic light colour? ')
if l=='green':
print('GO!')
elif l=='yellow':
print('get ready')
else:
print('stop')

2.
o=input('list one of the olympic values')
if o == 'respect' or 'excellence' or 'friendship':
print('that's correct')
else:
print('incorrect')
3.
l=int(input('how many days you spend on average watching tv?' ))
if l<= 2:
print('that should be ok')
elif l>= 2 and l<= 4:
print('that will damage your brain')
else:
print('that is too much')

4.
list=[1,2,3,4,5,6,7,8,9,10]
for i in range(len(list)):
print (list[i])

5.
for i in range(1,21,2)l):
print([i])

6.
i=int(input('guess a number between 1-20:'))
if i==7:
print('well done you guessed it')
else:
print('try again')

7.
def translate(a):
consonants='bcdfghjklmnpqrstvwxz'
result=''
for i in a:
if i in consonants:
result += i +'o'+ i
else:
result=result+i
return result

s=input('enter a string to convert into robers code')


print(translate(s))

LEVEL 7

1.

You might also like