File tree Expand file tree Collapse file tree 5 files changed +5
-5
lines changed Expand file tree Collapse file tree 5 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 1- # Write a program that reads a sentence from the keyboard and shows how many times the letter "a" appears and in what position it is
1+ #26- Write a program that reads a sentence from the keyboard and shows how many times the letter "a" appears and in what position it is
22# appears the first time and in what position it appears last time.
33sentence = input ('Enter a sentence:' ).upper ()
44print (f'The letter A shows { sentence .count ('A' )} times.' )
Original file line number Diff line number Diff line change 1- # Write a program that makes the computer "think" of an integer between 0 and 5 and ask the user to try
1+ #28- Write a program that makes the computer "think" of an integer between 0 and 5 and ask the user to try
22# find out which number was chosen by the computer. The program should write on the screen whether the user won or
33# it lost.
44from random import randint
Original file line number Diff line number Diff line change 1- # Write a program that reads the speed of a car. If it exceeded 80km/h, show a message saying that it
1+ #29- Write a program that reads the speed of a car. If it exceeded 80km/h, show a message saying that it
22# was fined. The fine will cost R$7.00 for each km above the limit.
33speed = float (input ('Enter the speed of your car:' ))
44if speed > 80 :
Original file line number Diff line number Diff line change 1- # Create a program that reads an integer and tells you whether it is even or odd.
1+ #30- Create a program that reads an integer and tells you whether it is even or odd.
22number = int (input ('Enter a number:' ))
33result = number % 2
44if result == 0 :
Original file line number Diff line number Diff line change 1- # Make a program that reads any year and shows whether it is a leap year.
1+ #32- Make a program that reads any year and shows whether it is a leap year.
22year = int (input ('Which year do you want to analize?' ))
33if year % 4 == 0 and year % 100 != 0 or year % 400 == 0 :
44 print (f"The year { year } it's a leap year" )
You can’t perform that action at this time.
0 commit comments