Answer:
The program to this question as follows:
Program:
def lettersOnly(s): #defining method lettersOnly
val="" #defining string variable that return value
for i in s: #defining loop to calculate value
if(i.isalpha()): #check condition that value is string
val=val+ i #add value
return val #return value
print(lettersOnly("data3base_ro1c3k5s")) #call method and print value
Output:
databaserocks
Explanation:
In the above python code, a method lettersOnly is declared that accepts a string variable "s" in its parameter. Inside the method, a string variable "val", and loop is declared, in which the "val" variable holds method return value.
- In the loop and if block is used that uses "isalpha" string method, which checks the check alphabetic character in the given value. if this is true it will calculate all value in "val" variable and return its value.
- At the last, the print method is used, which calls the lettersOnly method and prints its return value.
Explanation:
1. special key combination that causes specific commands to be executed typically shortcut keys combine the ctrl or alt keys with some other keys.
2. 5 example of shortcut keys are:-
- 1. ctrl + A - select all
- 2.ctrl + B - bold
- 3. ctrl + C - copy
- 4. ctrl + U - under line
- 5. ctrl + v - paste
3. (i) open the start menu
(ii) open Windows task manager
(iii) close the currently active program
(iv) replace
(v) align center
4. the three importance of shortcut keys are :
- efficient and time saving :- using shortcut make you more efficient at doing certain task on your computer .
- multi-tasking :- being a multi Tasker is something required in life.
- health benefit :- cutting down on your mouse usage by using keyboard shortcut can help reduce the risk of RSI (Repetitive Syndrome Injury).
5. shortcut keys are very helpful because it take less time. keyboard shortcuts are generally used to expedite common operation by reducing input sequence to a few keystrokes.
number = float(input("Enter a number: "))
if number >= 0:
print(number**0.5)
I hope this helps!
Answer:
Part a: The program will print 3.
Part b: The program will print 4
Part c: The program will print 1.
Explanation:
Part a: As the scoping is static, the x integer has a value of 1 and the y integer has a value of 2 so the addition is 2+1=3.
Part b: As the scoping is dynamic with deep binding, the x integer has a value of 2 and the y integer has a value of 2 so the addition is 2+2=4.
Part c: As the scoping is dynamic with shallow binding, the x integer has a value of 1 so it will print 1.